-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Properly save and restore the Go build cache
- Loading branch information
1 parent
dfc1be0
commit 4bd465b
Showing
2 changed files
with
75 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: "Setup Go" | ||
description: "Setup Go with caching" | ||
inputs: | ||
cache-prefix: | ||
description: "Prefix for the cache key" | ||
required: true | ||
outputs: | ||
go-version: | ||
description: "The installed Go version" | ||
value: ${{ steps.setup-go.outputs.go-version }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- id: setup-go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.21" | ||
check-latest: true | ||
cache: false | ||
- id: cache-info | ||
shell: bash | ||
run: echo path=$(go env GOCACHE) >> $GITHUB_OUTPUT | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.cache-info.outputs.path }} | ||
key: ${{ inputs.cache-prefix }}-go-${{ steps.setup-go.outputs.go-version }}-mod-${{ hashFiles('.go-build-tags', 'go.sum') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters