Files
shaw ec0e489ab7 fix(release): require the tagged commit to carry the release VERSION
The sync-version-file job committed the VERSION bump to main only after
publishing, so every tag pointed at a commit whose VERSION was the previous
release (v0.2.19 through v0.2.26). Published artifacts were unaffected because
prepare rewrites VERSION from the tag, but source builds of a tag (go build,
GitHub source archives, Docker builds without .git) reported the old version.

prepare now fails before building or publishing when VERSION at the tag does
not match the tag version. A manual run with allow_version_mismatch=true
downgrades this to a warning for re-releasing older tags. The post-release
sync job is removed: the VERSION bump is committed before tagging instead.
2026-12-02 15:22:58 +08:00

3.3 KiB

Release matrix

The release workflow builds the frontend once, then runs each configured Go target on its own Linux runner. CGO_ENABLED=0 permits cross-compilation. The target matrix is read from .goreleaser.yaml, including its exclusions; simple releases select Linux amd64 only.

Each build uses GoReleaser OSS in snapshot mode with the selected release version and one target. Archive naming, bundled files, Go flags and release templates remain in the existing GoReleaser configurations. Every archive is accompanied by its source commit, target, version and SHA256. The publishing job verifies the complete matrix before building images or publishing. It uses GoReleaser's extra_files support to publish existing archives and checksums, with builds disabled. No Pro license is needed.

Go caches are isolated by target and refreshed on each source commit, with fallback to the preceding target cache. Save uses the original restore key, even if a build hook changes go.sum. Matrix jobs upload uniquely named artifacts. The publishing job extracts only the regular Linux binary from each verified archive and restores its executable permission before constructing Docker contexts. QEMU remains limited to runtime-image instructions. DockerHub images are omitted when its credentials are absent; GHCR is always retained. Simple mode still publishes only the amd64 GHCR image and the simple release description.

A tag push is rejected in prepare, before anything is built or published, unless backend/cmd/server/VERSION at the tagged commit already equals the tag version: commit the VERSION bump first, then tag that commit. Source builds of the tag (go build, GitHub source archives, Docker builds without .git) embed that file. To re-release an older tag created before this rule, run the workflow manually with allow_version_mismatch=true; it then emits a warning and builds with the tag version.

All build jobs use the commit resolved by prepare, including a manual release's selected tag. Helper scripts come from the workflow revision and are passed as a run-local artifact, so older application tags do not need to contain the new scripts. The workflow serializes release runs to prevent simultaneous updates to moving image tags.

Validate without publication

From a branch containing this workflow:

gh workflow run release.yml --ref <branch> \
  -f tag=<branch> -f dry_run=true -f simple_release=false

A dry run builds all selected archives and both runtime images, verifies artifact provenance and produces the final checksum file. It exports images locally as OCI archives instead of pushing them. It skips registry logins, GitHub Release publication, DockerHub description updates, and Telegram notifications. Test the simple path separately with simple_release=true.

Dry-run artifacts are available in the Actions run, including release-dry-run-report. Compare job start/end times, GoReleaser's build duration and cache restore results. Do not present an initial cold-cache run as a warmed-cache benchmark; publishing network time is not measured by dry runs.

Helper checks:

python -m pip install -r .github/release-tools/requirements-release.txt
python -m unittest discover -s .github/release-tools -p 'test_release_matrix.py'
bash -n .github/release-tools/release-images.sh