Tag releases, and name the version on the Overview
nix run .#release ends by creating the annotated tag vX.Y.Z on the released commit (the tags routers that update from the repository look for); it refuses a HEAD of another version and does nothing outside a checkout. The System card on the Overview says which nixos-router and NixOS run. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
+36
-2
@@ -1,16 +1,23 @@
|
||||
# Signs $release (a store path) as a binary cache and writes, into --out:
|
||||
# router-update-<version>.bundle one file to upload in the web UI
|
||||
# latest, cache/ the same, laid out for `router pulls from a URL`
|
||||
# usage: router-release --key KEYFILE [--out DIR] [--compression zstd|none]
|
||||
#
|
||||
# Run in a git checkout it also tags the commit that was released (vX.Y.Z, the
|
||||
# tags routers that update from the repository look for). The tag is local: it
|
||||
# has to be pushed with the branch. It is made last, so a release that fails
|
||||
# leaves no tag.
|
||||
# usage: router-release --key KEYFILE [--out DIR] [--compression zstd|none] [--no-tag]
|
||||
key=""
|
||||
out=dist
|
||||
compression=zstd
|
||||
tag=1
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
--key) key=$2; shift ;;
|
||||
--out) out=$2; shift ;;
|
||||
--compression) compression=$2; shift ;;
|
||||
*) echo "usage: router-release --key KEYFILE [--out DIR] [--compression zstd|none]" >&2; exit 2 ;;
|
||||
--no-tag) tag=0 ;;
|
||||
*) echo "usage: router-release --key KEYFILE [--out DIR] [--compression zstd|none] [--no-tag]" >&2; exit 2 ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
@@ -28,3 +35,30 @@ tar -C "$out" -cf "$out/router-update-$version.bundle" latest cache
|
||||
echo "release $version ($(du -h "$out/router-update-$version.bundle" | cut -f1)):"
|
||||
echo " upload $out/router-update-$version.bundle in the router's web UI (Update)"
|
||||
echo " or serve $out over HTTP(S) and give the router that URL"
|
||||
|
||||
if [ "$tag" -eq 1 ]; then
|
||||
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||
echo " tag none: not in a git repository"
|
||||
else
|
||||
head_version=$(git show HEAD:VERSION 2>/dev/null | tr -d '\n' || true)
|
||||
if [ "$head_version" != "$version" ]; then
|
||||
echo "router-release: the commit at HEAD is version '$head_version', not $version: not tagged" >&2
|
||||
echo " (commit the version, then: git tag -a v$version -m 'Release $version')" >&2
|
||||
exit 1
|
||||
fi
|
||||
head=$(git rev-parse HEAD)
|
||||
if git rev-parse -q --verify "refs/tags/v$version" >/dev/null; then
|
||||
if [ "$(git rev-parse "v$version^{commit}")" != "$head" ]; then
|
||||
echo "router-release: v$version is already a tag of another commit" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo " tag v$version exists"
|
||||
else
|
||||
git tag -a "v$version" -m "Release $version"
|
||||
echo " tag v$version on ${head:0:7}: push it with the branch (git push origin v$version)"
|
||||
fi
|
||||
if [ "$(cat "$release/rev")" != "$head" ]; then
|
||||
echo " note the release was built from a tree that differs from HEAD (uncommitted changes)"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user