Skip to content

Commit 90b5647

Browse files
unblock release notes generation on goreleaser action (#401)
The `changelog.disable: true` goreleaser setting prevents a passed `--release-notes` value from being used. We generate release notes and always supply this flag now, so let's make sure they get used. GitOrigin-RevId: 559b9fe6f3db037968f992adba4146ef181fda4a
1 parent c8f5646 commit 90b5647

2 files changed

Lines changed: 17 additions & 10 deletions

File tree

.github/workflows/release.yaml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,31 @@ jobs:
3232
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
3333
passphrase: ${{ secrets.PASSPHRASE }}
3434
- name: Extract release notes from CHANGELOG.md
35-
id: release_notes
35+
# Fails the release if CHANGELOG.md doesn't have an entry for this
36+
# version. Empty release notes are never intentional, and silently
37+
# shipping a release without them was the pain point that prompted
38+
# this strictness.
3639
run: |
40+
set -eo pipefail
3741
VERSION="${GITHUB_REF_NAME#v}"
38-
if bin/extract-release-notes.sh "$VERSION" CHANGELOG.md > release-notes.md; then
42+
HEAD_SHA="$(git rev-parse --short HEAD)"
43+
echo "Looking up CHANGELOG.md entry for $VERSION at $HEAD_SHA"
44+
45+
# `tee` mirrors the extracted notes into the action log; `pipefail`
46+
# ensures the script's exit status propagates through the pipeline.
47+
if bin/extract-release-notes.sh "$VERSION" CHANGELOG.md | tee release-notes.md; then
3948
printf '\n---\n**Full Changelog:** [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md)\n' >> release-notes.md
40-
echo "found=true" >> "$GITHUB_OUTPUT"
4149
else
42-
echo "::warning::No CHANGELOG.md entry found for ${VERSION}. Release will be created without notes."
43-
echo "found=false" >> "$GITHUB_OUTPUT"
50+
echo "::error::No CHANGELOG.md entry found for ${VERSION} at ${HEAD_SHA}. Aborting release."
51+
echo "::group::Top of CHANGELOG.md at ${HEAD_SHA}"
52+
head -40 CHANGELOG.md
53+
echo "::endgroup::"
54+
exit 1
4455
fi
4556
- name: Run GoReleaser
4657
uses: goreleaser/goreleaser-action@5742e2a039330cbb23ebf35f046f814d4c6ff811 # v5.1.0
4758
with:
48-
args: >-
49-
release --clean
50-
${{ steps.release_notes.outputs.found == 'true' && '--release-notes=release-notes.md' || '' }}
59+
args: release --clean --release-notes=release-notes.md
5160
env:
5261
# GitHub sets the GITHUB_TOKEN secret automatically.
5362
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ checksum:
3333
algorithm: sha256
3434
release:
3535
name_template: "v{{ .Version }}"
36-
changelog:
37-
disable: true
3836
signs:
3937
- artifacts: checksum
4038
args:

0 commit comments

Comments
 (0)