Build GitHub release notes from CHANGELOG.md
The release workflow previously derived release notes from merged pull
requests via release-changelog-builder-action, which yields nothing in our
Gerrit-based workflow (we don't use PRs). Instead, extract the section for
the pushed tag from CHANGELOG.md and use it as the release body, falling
back to a generic body if no matching section exists.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Change-Id: If0abefbfd2f74a3e7a74f2d3af72247b458b03eb
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 9958206..10ee701 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -27,43 +27,32 @@
else
echo "prerelease=false" >> $GITHUB_OUTPUT
fi
- - name: "Build Changelog"
- id: build_changelog
- uses: mikepenz/release-changelog-builder-action@v6
- with:
- configurationJson: |
- {
- "template": "#{{CHANGELOG}}",
- "categories": [
- {
- "title": "## 🚀 Features",
- "labels": ["feature", "enhancement"]
- },
- {
- "title": "## 🐛 Fixes",
- "labels": ["fix", "bug"]
- },
- {
- "title": "## 📦 Other",
- "labels": []
- }
- ],
- "ignore_labels": [
- "skip-changelog"
- ],
- "fetch_via_commits": true,
- "fetch_reviewers": false,
- "fetch_release_information": true,
- "fetch_reviews": false,
- "commit_mode": true
- }
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Extract release notes from CHANGELOG.md
+ id: changelog
+ run: |
+ TAG_NAME="${{ steps.get_version.outputs.tag_name }}"
+ # Pull the section for this version: everything between the
+ # "## [<tag>]" heading and the next "## [" heading. We author the
+ # changelog by hand (Gerrit workflow, no PRs to mine for notes).
+ NOTES=$(awk -v tag="$TAG_NAME" '
+ $0 ~ "^## \\[" tag "\\]" { flag=1; next }
+ /^## \[/ { flag=0 }
+ flag { print }
+ ' CHANGELOG.md)
+ if [ -z "$(echo "$NOTES" | tr -d '[:space:]')" ]; then
+ echo "No CHANGELOG.md section found for $TAG_NAME; falling back to a generic body." >&2
+ NOTES="Release $TAG_NAME"
+ fi
+ {
+ echo "notes<<__CHANGELOG_EOF__"
+ echo "$NOTES"
+ echo "__CHANGELOG_EOF__"
+ } >> "$GITHUB_OUTPUT"
- name: Create Release
uses: softprops/action-gh-release@v2
with:
- body: ${{ steps.build_changelog.outputs.changelog }}
+ body: ${{ steps.changelog.outputs.notes }}
tag_name: ${{ steps.get_version.outputs.tag_name }}
name: Release ${{ steps.get_version.outputs.tag_name }}
prerelease: ${{ steps.get_version.outputs.prerelease }}