Skip to content

Commit 7e3081c

Browse files
committed
ci: fix release workflow changelog extraction
The shell changelog-render/update scripts were removed when prepare-release moved to a Go tool, but release.yml still called them. Extract the tagged section from CHANGELOG.md instead, and drop the obsolete prepare-release workflow in favor of the local go tool. Signed-off-by: crozzy <joseph.crosland@gmail.com>
1 parent b14401b commit 7e3081c

3 files changed

Lines changed: 13 additions & 52 deletions

File tree

.github/workflows/prepare-release.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,19 @@ jobs:
2020
uses: actions/checkout@v7
2121
with:
2222
fetch-depth: 0
23-
persist-credentials: true # Needed to fetch the changelog ref.
2423
- name: Changelog
24+
# The CHANGELOG.md section for this tag is the source of truth; it was
25+
# written by prepare-release before the tag was cut.
2526
run: |
26-
git fetch origin refs/notes/changelog:refs/notes/changelog
27-
.github/scripts/changelog-render "${VERSION}" > "${GITHUB_WORKSPACE}/changelog"
27+
awk -v ver="${VERSION}" '
28+
index($0, "<a name=\"" ver "\"></a>") == 1 { found = 1 }
29+
found && /^<a name="/ && index($0, ver) == 0 { exit }
30+
found { print }
31+
' CHANGELOG.md > "${GITHUB_WORKSPACE}/changelog"
32+
if ! grep -q . "${GITHUB_WORKSPACE}/changelog"; then
33+
echo "::error::no CHANGELOG.md section found for ${VERSION}"
34+
exit 1
35+
fi
2836
- name: Create Release
2937
uses: actions/create-release@latest
3038
env:

docs/contributor/changelog.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,8 @@ The primary helper script is `changelog-edit`. It allows a user to sync down
2222
notes, edit an entry, or both. See the output of the `h` flag for more
2323
information.
2424

25-
The other script of interest is `changelog-render`, which can be used to render
26-
out the changelog on demand, assuming the changelog notes have been pulled
27-
locally.
28-
29-
The `changelog-update` script uses `changelog-render` to add to the
30-
`CHANGELOG.md` file in the repository root.
25+
To turn notes into a `CHANGELOG.md` section and open a release PR, use
26+
`go tool prepare-release` (see [Releases](./releases.md)).
3127

3228
### Formatting
3329

0 commit comments

Comments
 (0)