Skip to content

Commit 47105d8

Browse files
committed
ci: use cache yarn
1 parent 2effbc6 commit 47105d8

File tree

2 files changed

+42
-24
lines changed

2 files changed

+42
-24
lines changed

.github/workflows/release.yml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,23 @@ jobs:
1919
uses: actions/setup-node@v2
2020
with:
2121
node-version: 12
22+
- id: yarn-cache-dir
23+
name: Find Yarn's cache folder
24+
run: echo "::set-output name=path::$(yarn config get cacheFolder)"
2225
- name: Cache node modules
2326
uses: actions/cache@v2
27+
id: yarn-cache
2428
env:
2529
cache-name: cache-node-modules
2630
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') }}
31+
path: ${{ steps.yarn-cache-dir.outputs.path }}
32+
key: ${{ runner.os }}-yarn-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
3033
restore-keys: |
31-
${{ runner.os }}-build-${{ env.cache-name }}-
32-
${{ runner.os }}-build-
34+
${{ runner.os }}-yarn-${{ env.cache-name }}-
35+
${{ runner.os }}-yarn-
3336
${{ runner.os }}-
3437
- name: Install dependencies
38+
# if: ${{ !steps.yarn-cache.outputs.cache-hit }}
3539
env:
3640
CI: true
3741
run: |
@@ -49,19 +53,24 @@ jobs:
4953
- uses: actions/setup-node@v2
5054
with:
5155
node-version: 12
56+
- id: yarn-cache-dir
57+
name: Find Yarn's cache folder
58+
run: echo "::set-output name=path::$(yarn config get cacheFolder)"
5259
- name: Cache node modules
5360
uses: actions/cache@v2
61+
id: yarn-cache
5462
env:
5563
cache-name: cache-node-modules
5664
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') }}
65+
path: ${{ steps.yarn-cache-dir.outputs.path }}
66+
key: ${{ runner.os }}-yarn-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
6067
restore-keys: |
61-
${{ runner.os }}-build-${{ env.cache-name }}-
62-
${{ runner.os }}-build-
68+
${{ runner.os }}-yarn-${{ env.cache-name }}-
69+
${{ runner.os }}-yarn-
6370
${{ runner.os }}-
64-
- env:
71+
- name: Install dependencies
72+
# if: ${{ !steps.yarn-cache.outputs.cache-hit }}
73+
env:
6574
CI: true
6675
run: |
6776
yarn install
@@ -70,6 +79,6 @@ jobs:
7079
env:
7180
CI: true
7281
GH_TOKEN: ${{ secrets.GH_TOKEN }}
73-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
7483
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
7584
run: npx semantic-release

.github/workflows/test.release.yml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,23 @@ jobs:
1212
uses: actions/setup-node@v2
1313
with:
1414
node-version: 12
15+
- id: yarn-cache-dir
16+
name: Find Yarn's cache folder
17+
run: echo "::set-output name=path::$(yarn config get cacheFolder)"
1518
- name: Cache node modules
1619
uses: actions/cache@v2
20+
id: yarn-cache
1721
env:
1822
cache-name: cache-node-modules
1923
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') }}
24+
path: ${{ steps.yarn-cache-dir.outputs.path }}
25+
key: ${{ runner.os }}-yarn-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
2326
restore-keys: |
24-
${{ runner.os }}-build-${{ env.cache-name }}-
25-
${{ runner.os }}-build-
27+
${{ runner.os }}-yarn-${{ env.cache-name }}-
28+
${{ runner.os }}-yarn-
2629
${{ runner.os }}-
2730
- name: Install dependencies
31+
# if: ${{ !steps.yarn-cache.outputs.cache-hit }}
2832
env:
2933
CI: true
3034
run: |
@@ -41,19 +45,24 @@ jobs:
4145
- uses: actions/setup-node@v2
4246
with:
4347
node-version: 12
48+
- id: yarn-cache-dir
49+
name: Find Yarn's cache folder
50+
run: echo "::set-output name=path::$(yarn config get cacheFolder)"
4451
- name: Cache node modules
4552
uses: actions/cache@v2
53+
id: yarn-cache
4654
env:
4755
cache-name: cache-node-modules
4856
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') }}
57+
path: ${{ steps.yarn-cache-dir.outputs.path }}
58+
key: ${{ runner.os }}-yarn-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
5259
restore-keys: |
53-
${{ runner.os }}-build-${{ env.cache-name }}-
54-
${{ runner.os }}-build-
60+
${{ runner.os }}-yarn-${{ env.cache-name }}-
61+
${{ runner.os }}-yarn-
5562
${{ runner.os }}-
56-
- env:
63+
- name: Install dependencies
64+
# if: ${{ !steps.yarn-cache.outputs.cache-hit }}
65+
env:
5766
CI: true
5867
run: |
5968
yarn install
@@ -62,7 +71,7 @@ jobs:
6271
CI: true
6372
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
6473
GITHUB_HEAD_REF: $GITHUB_HEAD_REF
65-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
74+
GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}"
6675
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
6776
run: |
6877
echo "//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN" > /home/runner/work/_temp/.npmrc

0 commit comments

Comments
 (0)