Skip to content

Commit

Permalink
chore: Add Windows image version to cache key
Browse files Browse the repository at this point in the history
  • Loading branch information
KapJI committed Nov 20, 2024
1 parent fb61fd6 commit 6bee848
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions .github/actions/setup-go/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ runs:
echo "GOMODCACHE=D:\\golang\\modcache" >> $GITHUB_ENV
echo "GOPATH=D:\\golang\\go" >> $GITHUB_ENV
echo "USERPROFILE=D:\\homedir" >> $GITHUB_ENV
echo "OS_EXTRA_VERSION=${ImageVersion}-v2-" >> $GITHUB_ENV
elif [ "$RUNNER_OS" = "macOS" ]; then
echo "GOCACHE=/Users/runner/go/pkg/mod" >> $GITHUB_ENV
echo "GOMODCACHE=/Users/runner/Library/Caches/go-build" >> $GITHUB_ENV
Expand All @@ -36,18 +37,18 @@ runs:
path: |
${{ env.GOCACHE }}
${{ env.GOMODCACHE }}
key: ${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-${{ hashFiles('**/go.sum') }}
key: ${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-${{ env.OS_EXTRA_VERSION }}${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-
${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-${{ env.OS_EXTRA_VERSION }}
- uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a
if: ${{ inputs.upload-cache != 'true' }}
with:
path: |
${{ env.GOCACHE }}
${{ env.GOMODCACHE }}
key: ${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-${{ hashFiles('**/go.sum') }}
key: ${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-${{ env.OS_EXTRA_VERSION }}${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-
${{ inputs.cache-prefix }}-${{ runner.os }}-${{ runner.arch }}-go-${{ inputs.go-version }}-${{ env.OS_EXTRA_VERSION }}
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed
with:
cache: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ jobs:
go-version: ${{ env.GO_VERSION }}
- name: build
run: |
go build -v ./...
go build -v -x ./...
- name: run
run: |
go run . --version
Expand Down

0 comments on commit 6bee848

Please sign in to comment.