From 0b2eef9a1bfaeeefdb9a582420f66338ead3d6f1 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Wed, 7 Oct 2026 00:35:13 +1100 Subject: [PATCH] ci(deploy): build the archied and agent images in parallel so the release zip waits only on the agent image --- .github/workflows/deploy.yml | 53 ++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index cc74a237f..ddfb5fe09 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -170,9 +170,7 @@ jobs: echo "This commit is not a release, so the images are published as :edge and sha-; :latest keeps naming the newest release." fi - build-and-push: - outputs: - agent_digest: ${{ steps.agent.outputs.digest }} + archied-image: needs: gate runs-on: ubuntu-latest steps: @@ -264,6 +262,43 @@ jobs: cache-from: type=gha,scope=archied cache-to: type=gha,mode=max,scope=archied + + agent-image: + outputs: + agent_digest: ${{ steps.agent.outputs.digest }} + needs: gate + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # Annotated tags: dereference to the commit, as archied-image does. + - name: Resolve the commit this ref points at + id: commit + run: | + sha="$(git rev-parse "${GITHUB_REF}^{commit}")" + echo "sha=$sha" >> "$GITHUB_OUTPUT" + echo "short=${sha:0:12}" >> "$GITHUB_OUTPUT" + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GHCR + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin + + - name: Resolve runtime version + id: versions + run: | + RUNTIME_TAG="$(git tag --points-at HEAD --list 'archie/v*' | sort -V | tail -1)" + RELEASE_TAG="$(git tag --points-at HEAD --list 'v*' | sort -V | tail -1)" + RUNTIME_VERSION="${RUNTIME_TAG#archie/}" + [ -n "$RUNTIME_VERSION" ] || RUNTIME_VERSION="${RELEASE_TAG#v}" + echo "runtime_tag=$RUNTIME_TAG" >> "$GITHUB_OUTPUT" + echo "release_tag=$RELEASE_TAG" >> "$GITHUB_OUTPUT" + echo "runtime=$RUNTIME_VERSION" >> "$GITHUB_OUTPUT" + - name: Build and push archie-agent id: agent if: steps.versions.outputs.runtime_tag != '' || steps.versions.outputs.release_tag != '' @@ -283,14 +318,10 @@ jobs: # Packages every host-run binary (archied, archie-gateway, # archie-state-store, archie-ui, archie-messaging) as a # linux/amd64 zip for a - # non-Docker install. Independent of build-and-push: it never touches the - # archied/archie-agent image jobs, and a gateway-only release (no - # archie/v* tag) still produces this zip -- it's keyed to the archied tag - # alone. archie-agent is deliberately excluded: it only ever runs inside - # the Docker image build-and-push already publishes, never as a host - # binary (archie-core-8cda.4.7.1). + # non-Docker install. It waits only for the agent image, whose digest + # release.json pins; archie-agent itself never ships as a host binary. dist-zip: - needs: [gate, build-and-push] + needs: [gate, agent-image] # 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 @@ -352,7 +383,7 @@ jobs: done cp deployments/INSTRUCTIONS.md CHANGELOG.md "$name/" cp scripts/archie-update-* "$name/" - digest='${{ needs.build-and-push.outputs.agent_digest }}' + digest='${{ needs.agent-image.outputs.agent_digest }}' test -n "$digest" jq --arg image "ghcr.io/samcharles93/archie-agent@$digest" '. + {agent_image: $image}' release.json > "$name/release.json" # README.md doesn't exist yet in this repo; include it once it does