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"