mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-09-07 15:44:10 +00:00
ci: source release notes from CHANGELOG.md (#712)
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 now fails the job rather than registering an empty changelog — the same reasoning as the token check added in #708. A manual dispatch falls back to the release body instead, since re-registering a release older than this file is legitimate. Section boundaries are matched on version headings rather than any "## ", because release notes routinely contain their own second-level headings: 5 of the 12 historical 2.x releases do. Verified by round-tripping 2.4.2 (2504 bytes, byte-identical) and 2.4.0 (5 inner headings, no content lost), and that "2.4" does not match the "2.4.2" section. Backfilled with the 2.4.x line; older releases stay on GitHub.
This commit is contained in:
@@ -216,9 +216,22 @@ jobs:
|
||||
MIN_PHP=$(php -r '$c=require "config/installer.php"; echo $c["core"]["minPhpVersion"] ?? "";')
|
||||
EXTS=$(php -r '$c=require "config/installer.php"; echo implode(", ", $c["requirements"]["php"] ?? []);')
|
||||
|
||||
# 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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user