ci: fix cache keys (#29962)

This commit is contained in:
Michael Kriese 2024-07-01 14:51:37 +02:00 committed by GitHub
parent 6d01a1d73e
commit 174b1bf54e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -47,6 +47,11 @@ runs:
(steps.node-modules-restore.outputs.cache-hit == 'true') && 'true' || ''
}}' >> "$GITHUB_ENV"
- name: Calculate `PNPM_STORE`
shell: bash
run: |
echo "PNPM_STORE=$(pnpm store path)" >> "$GITHUB_ENV"
- name: Setup pnpm
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
with:
@ -56,7 +61,21 @@ runs:
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: ${{ inputs.node-version }}
cache: ${{ env.CACHE_HIT != 'true' && 'pnpm' || '' }}
- name: Cache and restore `pnpm store`
if: env.CACHE_HIT != 'true'
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ${{ env.PNPM_STORE }}
key: |
pnpm_store-${{
inputs.os
}}-${{
inputs.node-version
}}-${{
hashFiles('pnpm-lock.yaml', 'package.json')
}}
enableCrossOsArchive: true
- name: Install dependencies
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0