Skip to content

Commit 1e44be8

Browse files
committed
ci: use cache yarn
1 parent 1b240c6 commit 1e44be8

File tree

2 files changed

+28
-32
lines changed

2 files changed

+28
-32
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,17 @@ jobs:
1919
uses: actions/setup-node@v2
2020
with:
2121
node-version: 12
22+
- name: Get yarn cache directory path
23+
id: yarn-cache-dir-path
24+
run: echo "::set-output name=dir::$(yarn cache dir)"
2225
- name: Cache node modules
2326
uses: actions/cache@v2
24-
env:
25-
cache-name: cache-node-modules
27+
id: yarn-cache
2628
with:
27-
# npm cache files are stored in `~/.npm` on Linux/macOS
28-
path: ~/.npm
29-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
29+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
30+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
3031
restore-keys: |
31-
${{ runner.os }}-build-${{ env.cache-name }}-
32-
${{ runner.os }}-build-
33-
${{ runner.os }}-
32+
${{ runner.os }}-yarn-
3433
- name: Install dependencies
3534
env:
3635
CI: true
@@ -49,18 +48,17 @@ jobs:
4948
- uses: actions/setup-node@v2
5049
with:
5150
node-version: 12
51+
- name: Get yarn cache directory path
52+
id: yarn-cache-dir-path
53+
run: echo "::set-output name=dir::$(yarn cache dir)"
5254
- name: Cache node modules
5355
uses: actions/cache@v2
54-
env:
55-
cache-name: cache-node-modules
56+
id: yarn-cache
5657
with:
57-
# npm cache files are stored in `~/.npm` on Linux/macOS
58-
path: ~/.npm
59-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
58+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
59+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
6060
restore-keys: |
61-
${{ runner.os }}-build-${{ env.cache-name }}-
62-
${{ runner.os }}-build-
63-
${{ runner.os }}-
61+
${{ runner.os }}-yarn-
6462
- env:
6563
CI: true
6664
run: |

.github/workflows/test.release.yml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,17 @@ jobs:
1212
uses: actions/setup-node@v2
1313
with:
1414
node-version: 12
15+
- name: Get yarn cache directory path
16+
id: yarn-cache-dir-path
17+
run: echo "::set-output name=dir::$(yarn cache dir)"
1518
- name: Cache node modules
1619
uses: actions/cache@v2
17-
env:
18-
cache-name: cache-node-modules
20+
id: yarn-cache
1921
with:
20-
# npm cache files are stored in `~/.npm` on Linux/macOS
21-
path: ~/.npm
22-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
22+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
23+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
2324
restore-keys: |
24-
${{ runner.os }}-build-${{ env.cache-name }}-
25-
${{ runner.os }}-build-
26-
${{ runner.os }}-
25+
${{ runner.os }}-yarn-
2726
- name: Install dependencies
2827
env:
2928
CI: true
@@ -41,18 +40,17 @@ jobs:
4140
- uses: actions/setup-node@v2
4241
with:
4342
node-version: 12
43+
- name: Get yarn cache directory path
44+
id: yarn-cache-dir-path
45+
run: echo "::set-output name=dir::$(yarn cache dir)"
4446
- name: Cache node modules
4547
uses: actions/cache@v2
46-
env:
47-
cache-name: cache-node-modules
48+
id: yarn-cache
4849
with:
49-
# npm cache files are stored in `~/.npm` on Linux/macOS
50-
path: ~/.npm
51-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
50+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
51+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
5252
restore-keys: |
53-
${{ runner.os }}-build-${{ env.cache-name }}-
54-
${{ runner.os }}-build-
55-
${{ runner.os }}-
53+
${{ runner.os }}-yarn-
5654
- env:
5755
CI: true
5856
run: |

0 commit comments

Comments
 (0)