From f2fc1ac5337390cd923a62430c6266e2e10d74c8 Mon Sep 17 00:00:00 2001 From: Zhoujie628 Date: Wed, 9 Sep 2026 17:23:18 +0800 Subject: [PATCH] ci: create a GitHub release from the changelog after publishing Add a second job that runs only for tag pushes after the Maven publish succeeds: it extracts the tagged version's section from CHANGELOG.md and creates the GitHub release with those notes via gh, so the Releases page is populated automatically instead of requiring a manual step. Signed-off-by: Zhoujie628 --- .github/workflows/release.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1202be7..1f67175 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -138,3 +138,36 @@ jobs: -Drevision="${VERSION}" \ -Dgpg.executable=gpg \ -Dgpg.keyname="${SIGNING_KEY_ID}" + + github-release: + name: Create GitHub release from changelog + needs: release + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout changelog + uses: actions/checkout@v5 + + - name: Create release + shell: bash + env: + GH_TOKEN: ${{ github.token }} + run: | + VERSION="${GITHUB_REF_NAME#v}" + NOTES=$(awk -v ver="$VERSION" ' + index($0, "## [" ver "]") == 1 { found = 1; next } + found && /^## \[/ { exit } + found { print } + ' CHANGELOG.md) + HEADER="Released to Maven Central as net.openan.workflow.sdk:*:${VERSION}." + if [ -n "$NOTES" ]; then + BODY="${HEADER} + + ${NOTES}" + else + BODY="$HEADER" + fi + gh release create "${GITHUB_REF_NAME}" --verify-tag \ + --title "${GITHUB_REF_NAME}" --notes "$BODY"