ci: source release notes from CHANGELOG.md (#713)

Port of the 2.x change to 3.x, with the same extractor script.

Registration sent the GitHub release body to the updater, so the notes
every install sees were written at publish time — after review, outside
the repo, with nothing checking they existed or matched what shipped.

CHANGELOG.md becomes the source. It is written and reviewed alongside the
change itself, so what installs are offered cannot drift from what was
merged, and the release body can simply point at it.

A release with no section for its tag fails the job rather than
registering an empty changelog. A manual dispatch falls back to the
release body, since re-registering a release older than this file is
legitimate — which covers 3.0.0-alpha.1.

Backfilled with 3.0.0-alpha.1.
This commit is contained in:
Darko Gjorgjijoski
2026-07-29 15:04:30 +02:00
committed by GitHub
parent 00cb1a6389
commit 3308f3b2fa
3 changed files with 103 additions and 1 deletions

View File

@@ -206,7 +206,22 @@ jobs:
# Read the notes and pre-release flag from the release itself, so this behaves
# identically whether triggered by a publish or re-run later by hand.
gh release view "$TAG" --repo "$GITHUB_REPOSITORY" --json body --jq '.body' > /tmp/changelog.txt
# CHANGELOG.md is the source: it is written and reviewed alongside the
# change itself, so what installs are offered cannot drift from what was
# merged. A release with no section fails here rather than registering an
# empty changelog — except on a manual dispatch, where re-registering a
# release older than the file is legitimate and the GitHub body stands in.
if php .github/scripts/changelog-section.php "$TAG" > /tmp/changelog.txt; then
echo "Using the CHANGELOG.md section for $TAG"
elif [ "$EVENT" = "release" ]; then
echo "::error::No CHANGELOG.md section for $TAG — add one and re-run this job."
exit 1
else
echo "::warning::No CHANGELOG.md section for $TAG — falling back to the release body."
gh release view "$TAG" --repo "$GITHUB_REPOSITORY" --json body --jq '.body' > /tmp/changelog.txt
fi
# The pre-release flag and timestamp come from the release itself, so this
# behaves identically whether triggered by a publish or re-run by hand.
PRERELEASE=$(gh release view "$TAG" --repo "$GITHUB_REPOSITORY" --json isPrerelease --jq '.isPrerelease')
PUBLISHED=$(gh release view "$TAG" --repo "$GITHUB_REPOSITORY" --json publishedAt --jq '.publishedAt')