ci(release): publish the release notes, not just the tag
The repository had two tags and no releases, so the only way to find out what a version changed was to open CHANGELOG.md and scroll to the right heading. The release page is where people who do not read changelogs look, and a repository with tags and no releases reads as abandoned. Notes come from CHANGELOG.md rather than from the commit range. The section was written for humans and already exists by the time a tag is cut; generated notes would restate merge subjects nobody chose. `scripts/changelog-section.mjs` extracts one version's section and makes its relative links absolute against the tag — a release body resolves them against the release page, not the repository, so `./BENCHMARKS.md` would have 404'd. That script is a parser writing text that cannot be corrected quietly once it is published, so its boundaries are pinned by a test rather than checked by eye at release time. Both of the bugs it caught while being written are in there: a section swallowing the `[label]: url` block that follows the oldest version, and a relative link surviving into a body. The step is idempotent like the publishes before it, so a re-run finishes what is left instead of stopping here, and `--verify-tag` keeps it from inventing a tag — it attaches to the one that triggered the run and cannot move it. A prerelease is marked as one, which is what keeps the "Latest" badge off a beta. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
3 files changed
+113
-1
No files matched your search
@@ -16,7 +16,7 @@ jobs:
|
||||
PKG: '@green-tea/core'
|
||||
permissions:
|
||||
id-token: write # OIDC for Trusted Publishing (also enables provenance)
|
||||
contents: read
|
||||
contents: write # create the GitHub release for this tag
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
@@ -94,3 +94,26 @@ jobs:
|
||||
else
|
||||
deno publish
|
||||
fi
|
||||
|
||||
# The release page is where people who do not read a changelog find out what changed, and a
|
||||
# repository with tags and no releases reads as abandoned. Notes come from CHANGELOG.md rather
|
||||
# than from the commit range: the section was written for humans and already exists by the time
|
||||
# a tag is cut, and generated notes would restate merge subjects nobody chose.
|
||||
#
|
||||
# Idempotent like the publishes above, so a re-run after a later failure does not stop here.
|
||||
# `--verify-tag` refuses to invent a tag: the release attaches to the one that triggered this
|
||||
# run and can never move it. A prerelease is marked as such, which is what keeps GitHub's
|
||||
# "Latest" badge off a beta.
|
||||
- name: Create the GitHub release
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
VERSION=$(node -p "require('./package.json').version")
|
||||
TAG=${GITHUB_REF_NAME}
|
||||
if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
|
||||
echo "release $TAG already exists"; exit 0
|
||||
fi
|
||||
node scripts/changelog-section.mjs "$VERSION" "$TAG" > /tmp/notes.md
|
||||
case "$VERSION" in *-*) PRE=--prerelease ;; *) PRE= ;; esac
|
||||
gh release create "$TAG" --repo "$GITHUB_REPOSITORY" --title "$TAG" \
|
||||
--notes-file /tmp/notes.md --verify-tag $PRE
|
||||
Reference in new issue
Block a user