mirror of
https://github.com/pollen-robotics/microduck.git
synced 2026-11-22 06:29:20 +08:00
Two things 0.4.0 exposed. **The release everybody reads said nothing about itself.** A promoted release's notes were "Promoted from `daemon-staging-v0.4.0`", and the changelog lived on the staging release — which promotion then deletes. So the stable release, the one people open, had no account of what was in it. `scripts/ci-release-notes.sh` composes the notes both workflows use: why these bytes exist, then what changed. The changelog comes from GitHub's own generator rather than a file in the repo — a hand-maintained CHANGELOG.md is a second place to forget, and the generator already knows the merged pull requests, which is what this history is made of. Its left edge is the previous *stable* tag, chosen explicitly. Letting the generator pick would mean "since the most recent release of any kind", and `dev.yml` publishes a prerelease on every push to every branch — so a changelog would usually cover the last twenty minutes. Notes are only written when there are none. Anything typed into the UI is somebody's deliberate description of their own release and outranks a generated one. **A cancelled run reports as a failed check.** Publishing in the UI fired both the tag `push` and `release: published`, the concurrency group cancelled one, and the tag then showed a red ✗ for a release that was entirely fine — which is worse than the duplicate it was fixing, because it teaches people to ignore the badge. Publishing in the UI creates the tag, so `push` covers that path on its own — verified both ways while cutting 0.4.0. The `release` trigger is gone, and `cancel-in-progress` with it. What one trigger gives up is publishing a release against a tag that already exists, which built on its own push anyway. `ci-release-notes.sh` joins the shellcheck list, unlike `ci-cross-deps.sh`: it runs during a release, which is the worst moment to find a typo. Assisted-by: Claude:claude-opus-5[1m]
57 lines
2.7 KiB
Bash
Executable File
57 lines
2.7 KiB
Bash
Executable File
#!/bin/sh
|
|
# Compose release notes: why this release exists, then what changed in it.
|
|
#
|
|
# Called by `_build-release.yml` and `_promote-release.yml`, so the two cannot drift into describing
|
|
# releases differently — and because the interesting half of the problem is the same for both.
|
|
#
|
|
# The problem it solves: a promoted release said only "Promoted from daemon-staging-v0.4.0", and the
|
|
# changelog lived on the staging release, which promotion deletes. So the stable release — the one
|
|
# anybody actually reads — ended up with no account of what was in it.
|
|
#
|
|
# The changelog comes from GitHub's own generator rather than from a file in the repo. That is
|
|
# deliberate: a hand-maintained CHANGELOG.md is a second place to forget, and the generator already
|
|
# knows the merged pull requests, which is what this project's history is made of.
|
|
#
|
|
# Reads: TAG the tag being published
|
|
# PROVENANCE a sentence or two on where these bytes came from
|
|
# GH_TOKEN needed by `gh`
|
|
# Writes: the composed notes, on stdout.
|
|
set -eu
|
|
|
|
: "${TAG:?TAG is required}"
|
|
: "${PROVENANCE:?PROVENANCE is required}"
|
|
|
|
# The previous *stable* release, which is the sensible left edge of a changelog for either channel: a
|
|
# candidate answers "what is new since the last release people are running", and so does the release
|
|
# it becomes.
|
|
#
|
|
# Explicit rather than letting the generator choose, because it would otherwise pick the most recent
|
|
# release of any kind — and `dev.yml` publishes a prerelease on every push to every branch, so
|
|
# "since the last release" would usually mean "since twenty minutes ago".
|
|
previous="$(gh release list --limit 100 --json tagName,isPrerelease,isDraft \
|
|
--jq '[.[] | select(.isPrerelease == false and .isDraft == false) | .tagName]
|
|
| map(select(startswith("daemon-v")))
|
|
| first // empty' 2>/dev/null || true)"
|
|
|
|
# Not fatal if it is missing or fails. Notes without a changelog are worse than notes with one and
|
|
# better than a failed release: this runs after the artifact is signed and verified.
|
|
changelog=""
|
|
if [ -n "$previous" ] && [ "$previous" != "$TAG" ]; then
|
|
changelog="$(gh api "repos/${GITHUB_REPOSITORY}/releases/generate-notes" \
|
|
-f "tag_name=${TAG}" \
|
|
-f "previous_tag_name=${previous}" \
|
|
--jq .body 2>/dev/null || true)"
|
|
else
|
|
# No previous stable release, or this is it. The generator handles that on its own.
|
|
changelog="$(gh api "repos/${GITHUB_REPOSITORY}/releases/generate-notes" \
|
|
-f "tag_name=${TAG}" \
|
|
--jq .body 2>/dev/null || true)"
|
|
fi
|
|
|
|
printf '%s\n' "$PROVENANCE"
|
|
if [ -n "$changelog" ]; then
|
|
printf '\n---\n\n%s\n' "$changelog"
|
|
else
|
|
printf '\n_No changelog could be generated for this release._\n'
|
|
fi
|