Skip to content

Commit

Permalink
git-artifacts: DRY up the package cache key
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
dscho committed Dec 31, 2024
1 parent 7c8cb2e commit 54ade7d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/git-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ jobs:
test "$ARCHITECTURE" != x86_64 || ARTIFACTS_TO_BUILD="$ARTIFACTS_TO_BUILD nuget"
}
echo "ARTIFACTS_TO_BUILD=$ARTIFACTS_TO_BUILD" >> $GITHUB_ENV
echo "PKG_CACHE_KEY=pkg-$GIT_VERSION-$ARCHITECTURE-$TAG_GIT_WORKFLOW_RUN_ID" >> $GITHUB_ENV
- name: Configure user
run:
USER_NAME="${{github.actor}}" &&
Expand Down Expand Up @@ -203,7 +204,7 @@ jobs:
uses: actions/cache/restore@v4
with:
path: artifacts
key: pkg-${{env.GIT_VERSION}}-${{env.ARCHITECTURE}}-${{env.TAG_GIT_WORKFLOW_RUN_ID}}
key: ${{ env.PKG_CACHE_KEY }}
- name: Clone and update build-extra
if: steps.restore-cached-git-pkg.outputs.cache-hit != 'true'
run: |
Expand Down Expand Up @@ -321,7 +322,7 @@ jobs:
uses: actions/cache/save@v4
with:
path: artifacts
key: pkg-${{env.GIT_VERSION}}-${{env.ARCHITECTURE}}-${{env.TAG_GIT_WORKFLOW_RUN_ID}}
key: ${{ env.PKG_CACHE_KEY }}
- name: update check-run
uses: ./.github/actions/check-run-action
with:
Expand Down

0 comments on commit 54ade7d

Please sign in to comment.