Files
lucisv/tools/release_notes.sh
lucioandClaude Fable 5 19253c105b
ci / checks (push) Successful in 41s
release / build-and-publish (push) Successful in 3m12s
CI on Gitea Actions: checks on push, full cross-platform release on tag; v0.7.1
.gitea/workflows/ci.yml runs fmt/clippy/test on every master push and PR
on the self-hosted mac-arm64 runner (host mode, brew-serviced act_runner).
.gitea/workflows/release.yml turns a vX.Y.Z tag into a Gitea release:
tools/release.sh --cross (Apple Silicon + x86_64 macOS, musl and RHEL 8
linux-gnu, Windows; both binaries; .vsix; SHA256SUMS), a tag-vs-version
check, tools/release_notes.sh (the CHANGELOG section becomes the notes;
missing section fails the release) and tools/publish_release.sh
(get-or-create + attach, re-run safe). Version bumped to 0.7.1 with a
changelog covering directive-split and this flow.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-08-26 01:51:45 -07:00

32 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Print the CHANGELOG.md section for one version on stdout.
#
# Usage: tools/release_notes.sh <version> [changelog]
# tools/release_notes.sh 0.7.1 # section between "## 0.7.1 ..."
# # and the next "## " heading
#
# A missing or empty section is an error: the release workflow uses this to
# publish release notes, and every release ships with real, written notes —
# failing here fails the release, which is the point.
set -eu
[ $# -ge 1 ] || { echo "usage: $0 <version> [changelog]" >&2; exit 2; }
version=$1
changelog=${2:-CHANGELOG.md}
[ -r "$changelog" ] || { echo "cannot read $changelog" >&2; exit 2; }
notes=$(awk -v v="$version" '
$1 == "##" { grab = ($2 == v); next }
grab { print }
' "$changelog")
# Trim leading/trailing blank lines so the release body starts with content.
notes=$(printf '%s' "$notes" | sed -e '/./,$!d' | sed -e :a -e '/^\n*$/{$d;N;ba' -e '}')
[ -n "$notes" ] || {
echo "no CHANGELOG.md section for version $version -- write one before tagging" >&2
exit 1
}
printf '%s\n' "$notes"