Skip to content

Commit 54ade7d

Browse files
committed
git-artifacts: DRY up the package cache key
When caching the built package, a key is used that is constructed from the Git version, the architecture and the `tag-git` run ID. To make it easier to override this key, define it only once. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 7c8cb2e commit 54ade7d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

.github/workflows/git-artifacts.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ jobs:
172172
test "$ARCHITECTURE" != x86_64 || ARTIFACTS_TO_BUILD="$ARTIFACTS_TO_BUILD nuget"
173173
}
174174
echo "ARTIFACTS_TO_BUILD=$ARTIFACTS_TO_BUILD" >> $GITHUB_ENV
175+
echo "PKG_CACHE_KEY=pkg-$GIT_VERSION-$ARCHITECTURE-$TAG_GIT_WORKFLOW_RUN_ID" >> $GITHUB_ENV
175176
- name: Configure user
176177
run:
177178
USER_NAME="${{github.actor}}" &&
@@ -203,7 +204,7 @@ jobs:
203204
uses: actions/cache/restore@v4
204205
with:
205206
path: artifacts
206-
key: pkg-${{env.GIT_VERSION}}-${{env.ARCHITECTURE}}-${{env.TAG_GIT_WORKFLOW_RUN_ID}}
207+
key: ${{ env.PKG_CACHE_KEY }}
207208
- name: Clone and update build-extra
208209
if: steps.restore-cached-git-pkg.outputs.cache-hit != 'true'
209210
run: |
@@ -321,7 +322,7 @@ jobs:
321322
uses: actions/cache/save@v4
322323
with:
323324
path: artifacts
324-
key: pkg-${{env.GIT_VERSION}}-${{env.ARCHITECTURE}}-${{env.TAG_GIT_WORKFLOW_RUN_ID}}
325+
key: ${{ env.PKG_CACHE_KEY }}
325326
- name: update check-run
326327
uses: ./.github/actions/check-run-action
327328
with:

0 commit comments

Comments
 (0)