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 },