ci(deploy): produce a complete distribution zip on every release

Two independent faults meant archied v1.23.0 shipped no zip at all.

dist-zip was gated on `startsWith(github.ref, 'refs/tags/archied/v')`. A
release is pushed as main plus both tags at one SHA, the SHA-keyed
concurrency group collapses those three runs into one, and the survivor
is whichever ref started last. For v1.23.0 that was refs/heads/main, so
the job was skipped and both tag runs that would have matched had already
been cancelled: 0 artifacts across all three runs. Resolve the archied
tag from the commit, the way build-and-push already does, and gate on
that instead of on the ref that happened to win the race.

The zip was also incomplete. It carried archied, archie-gateway,
archie-state-store and archie-playbooks, but not archie-ui, which since
1.23.0 is the process that serves the dashboard: a deployment cannot be
stood up from those four. Build every process the reference deployment
runs, and stamp each with the archied version rather than leaving the
state store and playbooks unversioned.

Closes archie-core-803r, archie-core-xi02.
This commit is contained in:
sam committed 2026-09-12 09:51:44 +10:00
1 parent e427995d70
commit 2d228a00b4
1 file changed
+35 -9
+35 -9
View File
@@ -31,12 +31,29 @@ permissions:
jobs:
gate:
runs-on: ubuntu-latest
outputs:
archied_version: ${{ steps.release_tag.outputs.archied_version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Read the release from the commit, not from github.ref. One release
# push carries main and both tags at the same SHA, and only one of
# those refs survives the concurrency group, so a ref-derived version
# is whatever won the race. The tag at HEAD is the same either way.
- name: Resolve archied tag at HEAD
id: release_tag
run: |
version="$(git tag --points-at HEAD --list 'archied/v*' | sed 's|^archied/v||' | sort -V | tail -1)"
echo "archied_version=$version" >> "$GITHUB_OUTPUT"
if [ -n "$version" ]; then
echo "archied release at HEAD: $version"
else
echo "no archied tag at HEAD; distribution zip will be skipped"
fi
- name: Set up Go
uses: actions/setup-go@v5
with:
@@ -188,7 +205,14 @@ jobs:
# binary (archie-core-8cda.4.7.1).
dist-zip:
needs: gate
if: startsWith(github.ref, 'refs/tags/archied/v')
# Not gated on github.ref. A release is pushed as main plus both tags at
# one SHA, the concurrency group below collapses those into a single run,
# and the survivor is whichever ref happened to start last -- for
# v1.23.0 that was refs/heads/main, so this job was skipped and no zip
# was ever produced. Resolve the tag from the commit instead of trusting
# the ref that won the race, and skip only when there is genuinely no
# archied tag at HEAD.
if: needs.gate.outputs.archied_version != ''
runs-on: ubuntu-latest
steps:
- name: Checkout
@@ -201,7 +225,7 @@ jobs:
- name: Resolve archied version
id: version
run: echo "version=${GITHUB_REF#refs/tags/archied/v}" >> "$GITHUB_OUTPUT"
run: echo "version=${{ needs.gate.outputs.archied_version }}" >> "$GITHUB_OUTPUT"
- name: Build linux/amd64 binaries
env:
@@ -210,13 +234,15 @@ jobs:
CGO_ENABLED: "0"
run: |
set -e
ldflags_archied="-X github.com/samcharles93/archie-core/internal/app/archied.gatewayVersion=${{ steps.version.outputs.version }} -X github.com/samcharles93/archie-core/internal/installtype.buildType=binary"
ldflags_gateway="-X github.com/samcharles93/archie-core/internal/app/archied.gatewayVersion=${{ steps.version.outputs.version }} -X github.com/samcharles93/archie-core/internal/installtype.buildType=binary"
# Every process in the documented deployment ships in the zip, and
# every one of them carries the archied version it was cut from:
# they are one release, and an operator matching binaries by eye
# needs each to say so.
ldflags="-X github.com/samcharles93/archie-core/internal/app/archied.gatewayVersion=${{ steps.version.outputs.version }} -X github.com/samcharles93/archie-core/internal/installtype.buildType=binary"
mkdir -p dist
go build -ldflags "$ldflags_archied" -o dist/archied ./cmd/archied
go build -ldflags "$ldflags_gateway" -o dist/archie-gateway ./cmd/archie-gateway
go build -o dist/archie-state-store ./cmd/archie-state-store
go build -o dist/archie-playbooks ./cmd/archie-playbooks
for cmd in archied archie-gateway archie-state-store archie-ui archie-playbooks; do
go build -ldflags "$ldflags" -o "dist/$cmd" "./cmd/$cmd"
done
- name: Assemble distribution zip
id: zip
@@ -224,7 +250,7 @@ jobs:
set -e
name="archie-core-archied-v${{ steps.version.outputs.version }}-linux-amd64"
mkdir -p "$name"
cp dist/archied dist/archie-gateway dist/archie-state-store dist/archie-playbooks "$name/"
cp dist/archied dist/archie-gateway dist/archie-state-store dist/archie-ui dist/archie-playbooks "$name/"
cp deployments/INSTRUCTIONS.md CHANGELOG.md CHANGELOG.archied.md CHANGELOG.archie.md "$name/"
# README.md doesn't exist yet in this repo; include it once it does
# rather than fail the release on its absence.