dtc/scripts/prepare-release
David Gibson 25a368100a docs: Improvements to release creation tooling
Introduce prepare-release for the deterministic parts of preparing a
release.  Update AGENTS.md to use that, rather than using an LLM for
deterministic steps.

finalize-release now pushes the release commit and tag after signing, and
prepares a release announcement mail.

Assisted-by: Claude:claude-opus-4-6i
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2026-05-28 12:12:38 +10:00

70 lines
1.3 KiB
Bash
Executable file

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Prepare a release: update VERSION.txt and create the version bump
# commit. This handles steps 1 and 2 of the release procedure in
# AGENTS.md. Step 3 (drafting the tag message) requires judgement to
# categorise and summarise changes, so is left to the caller.
set -e
usage() {
echo "Usage: $0 <version>" >&2
echo "" >&2
echo " version X.Y.Z or vX.Y.Z" >&2
echo "" >&2
echo "Example: $0 1.8.1" >&2
exit 1
}
RAW="$1"
if [ -z "$RAW" ]; then
usage
fi
VERSION="${RAW#v}"
case "$VERSION" in
[0-9]*.[0-9]*.[0-9]*)
;;
*)
echo "Error: version '$VERSION' does not look like X.Y.Z" >&2
exit 1
;;
esac
TAG="v${VERSION}"
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Error: tag $TAG already exists" >&2
exit 1
fi
if ! git diff-index --quiet HEAD; then
echo "Error: working tree is dirty; commit or stash first" >&2
exit 1
fi
echo "$VERSION" > VERSION.txt
git add VERSION.txt
git commit -m "$(cat <<EOF
Bump version to $TAG
Prepare for a new release.
EOF
)"
echo "Building with make..."
git clean -fdx
make check
echo ""
echo "Building with meson..."
git clean -fdx
meson setup build
meson test -C build
echo ""
echo "All builds and tests passed."
echo "Next: draft the tag message to tag-message.txt, then run:"
echo " scripts/finalize-release tag-message.txt"