chore: upgrade to actions/cache@v4 (#47282)

* chore: add github-actions to dependabot

* chore: upgrade to actions/cache@v4
This commit is contained in:
afc163 2024-02-01 18:20:41 +08:00 committed by GitHub
parent 53b0b2475d
commit 584593b138
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 48 additions and 44 deletions

View File

@ -26,3 +26,7 @@ updates:
dev-dependencies:
dependency-type: "development"
update-types: ["major"]
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

View File

@ -24,7 +24,7 @@ jobs:
with:
node-version: 18
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~tmpProj/yarn.lock
key: primes-${{ runner.os }}-${{ github.run_id }}

View File

@ -24,7 +24,7 @@ jobs:
uses: actions/checkout@v4
- name: cache package-lock.json
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
@ -40,7 +40,7 @@ jobs:
cp package-lock.json package-temp-dir
- name: cache node_modules
id: node_modules_cache_id
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@ -58,13 +58,13 @@ jobs:
uses: actions/checkout@v4
- name: restore cache from package-lock.json
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@ -104,13 +104,13 @@ jobs:
uses: actions/checkout@v4
- name: restore cache from package-lock.json
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}

View File

@ -19,7 +19,7 @@ jobs:
uses: actions/checkout@v4
- name: cache package-lock.json
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
@ -35,7 +35,7 @@ jobs:
cp package-lock.json package-temp-dir
- name: cache node_modules
id: node_modules_cache_id
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@ -56,13 +56,13 @@ jobs:
node-version: 18
- name: restore cache from package-lock.json
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}

View File

@ -24,7 +24,7 @@ jobs:
node-version: 18
- name: cache package-lock.json
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
@ -40,7 +40,7 @@ jobs:
cp package-lock.json package-temp-dir
- name: cache node_modules
id: node_modules_cache_id
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@ -60,13 +60,13 @@ jobs:
node-version: 18
- name: restore cache from package-lock.json
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@ -75,8 +75,8 @@ jobs:
run: npm run lint
- name: lint:react-16
run: npm run compile && npm run install-react-16 && npm run tsc:old
run: npm run compile && npm run install-react-16 && npm run tsc:old
- name: lint:react-17
run: npm run compile && npm run install-react-17 && npm run tsc:old
needs: setup
@ -92,13 +92,13 @@ jobs:
node-version: 18
- name: restore cache from package-lock.json
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@ -117,19 +117,19 @@ jobs:
node-version: 18
- name: restore cache from package-lock.json
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: cache dist
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: dist
key: dist-${{ github.sha }}
@ -161,13 +161,13 @@ jobs:
node-version: 18
- name: restore cache from package-lock.json
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@ -186,7 +186,7 @@ jobs:
- name: restore cache from dist
if: ${{ matrix.module == 'dist' || matrix.module == 'dist-min' }}
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: dist
key: dist-${{ github.sha }}
@ -278,25 +278,25 @@ jobs:
node-version: 18
- name: restore cache from package-lock.json
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
- name: cache lib
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: lib
key: lib-${{ github.sha }}
- name: cache es
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: es
key: es-${{ github.sha }}
@ -335,7 +335,7 @@ jobs:
- name: restore cache from package-lock.json
# lib only run in master branch not in pull request
if: ${{ github.event_name != 'pull_request' || matrix.module != 'lib' }}
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
@ -343,7 +343,7 @@ jobs:
- name: restore cache from node_modules
# lib only run in master branch not in pull request
if: ${{ github.event_name != 'pull_request' || matrix.module != 'lib' }}
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@ -351,7 +351,7 @@ jobs:
- name: restore cache from ${{ matrix.module }}
# lib only run in master branch not in pull request
if: ${{ github.event_name != 'pull_request' || matrix.module != 'lib' }}
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ matrix.module }}
key: ${{ matrix.module }}-${{ github.sha }}

View File

@ -25,7 +25,7 @@ jobs:
uses: actions/checkout@v4
- name: cache package-lock.json
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
@ -42,7 +42,7 @@ jobs:
- name: cache node_modules
id: node_modules_cache_id
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@ -64,13 +64,13 @@ jobs:
node-version: 18
- name: restore cache from package-lock.json
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}

View File

@ -21,7 +21,7 @@ jobs:
uses: actions/checkout@v4
- name: cache package-lock.json
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
@ -37,7 +37,7 @@ jobs:
cp package-lock.json package-temp-dir
- name: cache node_modules
id: node_modules_cache_id
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
@ -55,13 +55,13 @@ jobs:
uses: actions/checkout@v4
- name: restore cache from package-lock.json
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: package-temp-dir
key: lock-${{ github.sha }}
- name: restore cache from node_modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}

View File

@ -233,7 +233,7 @@ To further optimize dependency installation speed, we can add pnpm caching. Afte
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}

View File

@ -238,7 +238,7 @@ jobs:
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache (设置 pnpm 缓存)
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}

View File

@ -44,7 +44,7 @@ Pass `--depth=1` to only pull the last commit. Then execute `yarn` to install de
Every time the build is successful, CI will cache the current `yarn.lock` file. In this way, if the next build fails, we can easily pull the two files for comparison to troubleshoot the problem. Although `actions/cache` does not allow cache keys with the same name, it allows `restore-keys` to get the latest cache, which is very convenient:
```yml
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~tmpProj/yarn.lock
key: primes-${{ runner.os }}-${{ github.run_id }}

View File

@ -44,7 +44,7 @@ on:
每次构建成功CI 都会缓存当下的 `yarn.lock` 文件。这样,我们在下次构建如果失败了,就可以很方便的拉取两份文件进行对比去排查问题。`actions/cache` 虽然不允许同名 cache key但是允许通过 `restore-keys` 来获取最近的 cache这就非常方便了
```yml
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~tmpProj/yarn.lock
key: primes-${{ runner.os }}-${{ github.run_id }}