From 028fea8fe0640cca2215fd5a0143e5f8dc6bfd72 Mon Sep 17 00:00:00 2001 From: Blair Hamilton Date: Sat, 15 Aug 2026 08:04:10 -0400 Subject: [PATCH] ci(release): warm the cross-compile build cache between releases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit setup-go's built-in cache is exact-match on go.sum (any dependency bump means a fully cold build of every GOOS/GOARCH target) and its immutable snapshot is claimed by whichever job saves first — usually a CI test job whose GOCACHE covers only host-platform test builds. Replace it in the release job with a go-release-* scoped module+build cache: a restore-keys prefix keeps dependency bumps warm, and the post step saves after goreleaser so the snapshot carries the full cross-compile matrix. First release populates it; later ones compile incrementally. --- .github/workflows/goreleaser.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 8d90c2c..9755da0 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -29,7 +29,21 @@ jobs: uses: actions/setup-go@v6 with: go-version: ${{ env.GO_VERSION }} - cache: true + cache: false # replaced by the release-scoped cache below + + # Release-scoped Go cache: setup-go's built-in cache is exact-match on + # go.sum and usually saved by CI test jobs (host-platform builds only); + # this one falls back on a restore-keys prefix and is saved at job end — + # after goreleaser — so it warms every cross-compiled GOOS/GOARCH target. + - name: Restore release Go cache + uses: actions/cache@v4 + with: + path: | + ~/go/pkg/mod + ~/.cache/go-build + key: go-release-${{ runner.os }}-${{ hashFiles('go.mod', 'go.sum') }} + restore-keys: | + go-release-${{ runner.os }}- - name: Checkout tag (workflow_dispatch) if: github.event_name == 'workflow_dispatch'