From dbf65c7847415977776b327c7f4bc2df88739cc6 Mon Sep 17 00:00:00 2001 From: Andrew A Date: Tue, 9 Jun 2026 23:09:38 +0200 Subject: [PATCH] chore: prevent divergences from changelog Address an issue noticed recently where the generated release notes were different than the actual changelog (particularly changelog contained hand edits). For now, we treat the changelog as the source of truth when generating release notes (parse it). This allows us to make manual edits on top of the automatically generated git-cliff logs when needed, and for them to be automatically included in the release. --- .github/workflows/release.yml | 19 ++++++++++++------- DEVELOPING.md | 2 +- cliff.toml | 1 + 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 30ec204..2ecda1f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -80,15 +80,20 @@ jobs: cd dist sha256sum * > checksums.txt - - uses: taiki-e/install-action@v2 - if: startsWith(github.ref, 'refs/tags/') - with: - tool: git-cliff@2 - - - name: Generate release notes + - name: Extract release notes from CHANGELOG.md if: startsWith(github.ref, 'refs/tags/') + env: + TAG: ${{ github.ref_name }} run: | - git-cliff --tag "${{ github.ref_name }}" --latest --output release-notes.md + awk -v tag="$TAG" ' + $0 ~ "^## " tag " " {found=1; next} + found && /^## / {exit} + found {print} + ' CHANGELOG.md > release-notes.md + if [ ! -s release-notes.md ]; then + echo "::error::No CHANGELOG.md section found for $TAG; update the changelog before tagging." >&2 + exit 1 + fi - name: Publish semver release if: startsWith(github.ref, 'refs/tags/') diff --git a/DEVELOPING.md b/DEVELOPING.md index 6c5fd36..50bf6a4 100644 --- a/DEVELOPING.md +++ b/DEVELOPING.md @@ -54,7 +54,7 @@ Once the run completes, anyone with read access can download the artifact for th ## Releasing -Releases are triggered by pushing a semver tag. The CI workflow builds 5-platform binaries, generates a changelog via `git-cliff`, and publishes a GitHub release. +Releases are triggered by pushing a semver tag. The CI workflow builds 5-platform binaries and publishes a GitHub release. The release notes are the matching version section extracted from `CHANGELOG.md` (the single source of truth), so the changelog must be committed before tagging. Prerequisites: [`git-cliff`](https://git-cliff.org/docs/installation). diff --git a/cliff.toml b/cliff.toml index d8719f6..bc1a5ad 100644 --- a/cliff.toml +++ b/cliff.toml @@ -27,6 +27,7 @@ commit_parsers = [ { message = "^refactor", group = "Refactor" }, { message = "^docs", group = "Documentation" }, { message = "^test", group = "Testing" }, + { message = "^chore: release", skip = true }, { message = "^chore", group = "Miscellaneous" }, { message = "^ci", skip = true }, { message = "^style", skip = true },