As thukthuk and lampbench-web: once the checks pass on a push to main, the CI job `release` reserves the next CalVer version (YYYY.M.MICRO, Bangkok time) with a draft release, builds the server on Ubuntu 22.04 (glibc 2.35) with that version and the commit (`VISA_COMMIT`), packs bin/visa, VERSION and COMMIT as visa-linux-x86_64.tar.gz, signs it with the repository secret RELEASE_SIGNING_KEY (ssh-keygen, namespace visa-release, principal visa-ci; checked against release/allowed-signers before it is published) and publishes the release. cnx01 will install a release only with that signature (cnx-network-clan modules/visa, in a PR of its own). - .gitea/scripts/release.py and test_release.py from lamp-testbench (the same reserve/publish/discard and version order), with visa's one archive; sign-release.sh; build-release.sh. The release scripts' tests run in the check job. - `visa --version` (and `visa version`): "visa <version> (<commit>)", which CI and cnx01's fetch check. - The key was made locally, put into the secret through the API and deleted; only its public half is in the repo. - README, AGENTS (main is live: push only whole steps), PLAN's decisions. Checks: fmt, clippy; test_release.py 14 tests OK in WSL; `visa --version`.
37 lines
1.4 KiB
Bash
37 lines
1.4 KiB
Bash
#!/usr/bin/env bash
|
|
# CI, job `release`: build the server for Linux x86_64 on Ubuntu 22.04 (so
|
|
# glibc 2.35 or newer runs it), with the release version and the commit in
|
|
# its --version, and pack it under a name without the version:
|
|
# dist/visa-linux-x86_64.tar.gz bin/visa, VERSION, COMMIT
|
|
# cnx01 installs it (cnx-network-clan modules/visa) after the job's next step
|
|
# has signed it (.gitea/scripts/sign-release.sh), and checks that VERSION is
|
|
# the release's name.
|
|
# bash .gitea/scripts/build-release.sh 2026.11.0
|
|
set -euo pipefail
|
|
version=${1:?version, e.g. 2026.11.0}
|
|
commit=$(git rev-parse HEAD)
|
|
|
|
# The tag is the source of truth: CI writes it into Cargo.toml (the committed
|
|
# one keeps a placeholder) and the lock file follows.
|
|
sed -i -E "/^\[package\]/,/^\[/ s/^version = \"[^\"]*\"/version = \"$version\"/" Cargo.toml
|
|
cargo update --workspace --quiet
|
|
|
|
# the footer's and /version's commit (build.rs)
|
|
VISA_COMMIT=$commit cargo build --release --locked --bin visa
|
|
|
|
got=$(target/release/visa --version)
|
|
if [ "$got" != "visa $version ($commit)" ]; then
|
|
echo "visa --version says '$got', expected 'visa $version ($commit)'" >&2
|
|
exit 1
|
|
fi
|
|
|
|
rm -rf dist
|
|
pack=dist/visa
|
|
mkdir -p "$pack/bin"
|
|
cp target/release/visa "$pack/bin/"
|
|
printf '%s\n' "$version" >"$pack/VERSION"
|
|
printf '%s\n' "$commit" >"$pack/COMMIT"
|
|
tar -C "$pack" --owner=0 --group=0 --numeric-owner -czf dist/visa-linux-x86_64.tar.gz bin VERSION COMMIT
|
|
rm -rf "$pack"
|
|
ls -l dist
|