From 8c3be300936c15f6a6ca736e23e4a21834f8f316 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Thu, 4 Jul 2024 13:39:55 +0200 Subject: [PATCH] Use different Go cache key for goreleaser jobs (#1558) ## Changes The goreleaser jobs perform a cross-platform build of the main binary without test files. It should use a different cache than the jobs that run tests for a single platform. This change also updates the `release-snapshot` job to use the latest goreleaser action, as was done in #1477. ## Tests Ran `release-snapshot` job from this PR. --- .github/workflows/release-snapshot.yml | 12 ++++++++++-- .github/workflows/release.yml | 7 +++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-snapshot.yml b/.github/workflows/release-snapshot.yml index faa5df0225..defd1c535e 100644 --- a/.github/workflows/release-snapshot.yml +++ b/.github/workflows/release-snapshot.yml @@ -23,13 +23,21 @@ jobs: with: go-version: 1.22.x + # The default cache key for this action considers only the `go.sum` file. + # We include .goreleaser.yaml here to differentiate from the cache used by the push action + # that runs unit tests. This job produces and uses a different cache. + cache-dependency-path: | + go.sum + .goreleaser.yaml + - name: Hide snapshot tag to outsmart GoReleaser run: git tag -d snapshot || true - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v4 + id: releaser + uses: goreleaser/goreleaser-action@v6 with: - version: latest + version: ~> v2 args: release --snapshot --skip docker - name: Upload macOS binaries diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cf356ca64d..531fb39bfd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,6 +24,13 @@ jobs: with: go-version: 1.22.x + # The default cache key for this action considers only the `go.sum` file. + # We include .goreleaser.yaml here to differentiate from the cache used by the push action + # that runs unit tests. This job produces and uses a different cache. + cache-dependency-path: | + go.sum + .goreleaser.yaml + # Log into the GitHub Container Registry. The goreleaser action will create # the docker images and push them to the GitHub Container Registry. - uses: "docker/login-action@v3"