ci(release): build changelog from commit log (not PR-only notes)
GitHub's generate_release_notes only lists merged PRs — near-empty for this commit-to-main repo, so releases still showed nothing. Render the conventional-commit subjects since the previous tag instead, and full-clone (fetch-depth:0) so the diff is available.
This commit is contained in:
@@ -39,6 +39,7 @@ jobs:
|
|||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.event.inputs.tag || github.ref }}
|
ref: ${{ github.event.inputs.tag || github.ref }}
|
||||||
|
fetch-depth: 0 # full history so the changelog step can diff tags
|
||||||
|
|
||||||
- name: Setup Rust toolchain
|
- name: Setup Rust toolchain
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
@@ -125,6 +126,29 @@ jobs:
|
|||||||
- name: List assets
|
- name: List assets
|
||||||
run: ls -la dist
|
run: ls -la dist
|
||||||
|
|
||||||
|
# Build the changelog from conventional-commit subjects since the previous
|
||||||
|
# tag. GitHub's built-in generate_release_notes only lists merged PRs,
|
||||||
|
# which is near-empty for this commit-to-main workflow — so we render the
|
||||||
|
# commit log ourselves and every release shows what actually changed.
|
||||||
|
- name: Generate changelog
|
||||||
|
id: changelog
|
||||||
|
run: |
|
||||||
|
TAG="${{ github.event.inputs.tag || github.ref_name }}"
|
||||||
|
PREV="$(git describe --tags --abbrev=0 "${TAG}^" 2>/dev/null || true)"
|
||||||
|
{
|
||||||
|
echo "notes<<__NOTES_EOF__"
|
||||||
|
echo "## What changed"
|
||||||
|
echo ""
|
||||||
|
if [ -n "$PREV" ]; then
|
||||||
|
git log "${PREV}..${TAG}" --no-merges --pretty='- %s' | grep -v '^- chore(release)' || true
|
||||||
|
echo ""
|
||||||
|
echo "**Full changelog**: https://github.com/${{ github.repository }}/compare/${PREV}...${TAG}"
|
||||||
|
else
|
||||||
|
git log "${TAG}" --no-merges --pretty='- %s' | grep -v '^- chore(release)' || true
|
||||||
|
fi
|
||||||
|
echo "__NOTES_EOF__"
|
||||||
|
} >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Attach to release
|
- name: Attach to release
|
||||||
uses: softprops/action-gh-release@v3
|
uses: softprops/action-gh-release@v3
|
||||||
with:
|
with:
|
||||||
@@ -133,10 +157,8 @@ jobs:
|
|||||||
dist/*.tar.gz
|
dist/*.tar.gz
|
||||||
dist/*.tar.gz.sha256
|
dist/*.tar.gz.sha256
|
||||||
fail_on_unmatched_files: true
|
fail_on_unmatched_files: true
|
||||||
# Auto-generate a changelog (commits + merged PRs since the previous
|
# The commit-based changelog so every release shows what changed. The
|
||||||
# tag) so every release shows what actually changed, instead of an
|
# first matrix job to run creates the release with these notes;
|
||||||
# empty body. The first matrix job to run creates the release with
|
# append_body:false keeps later platform jobs from duplicating them.
|
||||||
# these notes; `append_body: false` keeps later jobs from clobbering
|
body: ${{ steps.changelog.outputs.notes }}
|
||||||
# or duplicating them while they attach their platform's binaries.
|
|
||||||
generate_release_notes: true
|
|
||||||
append_body: false
|
append_body: false
|
||||||
|
|||||||
Reference in New Issue
Block a user