Skip to content

Commit 9dc27c7

Browse files
committed
ci: cache for yarn is included in setup-node
1 parent 8fa5012 commit 9dc27c7

File tree

4 files changed

+9
-64
lines changed

4 files changed

+9
-64
lines changed

.github/workflows/ci-blog-app.yml

+2-16
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,10 @@ jobs:
4242
- uses: actions/checkout@v2
4343

4444
- name: Use Node.js ${{ matrix.node-version }}
45-
uses: actions/setup-node@master
45+
uses: actions/setup-node@v2
4646
with:
4747
node-version: ${{ matrix.node-version }}
48-
49-
- name: Get yarn cache directory path
50-
id: yarn-cache-dir-path
51-
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
52-
53-
# Inspired by https://github.com/yarnpkg/berry/issues/954#issuecomment-629734719
54-
- name: Restore yarn cache
55-
uses: actions/cache@v2
56-
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
57-
with:
58-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
59-
key: yarn-cache-folder-os-${{ runner.os }}-node-${{ env.node-version }}-${{ hashFiles('**/yarn.lock') }}
60-
restore-keys: |
61-
yarn-cache-folder-os-${{ runner.os }}-node-${{ env.node-version }}-
62-
yarn-cache-folder-os-${{ runner.os }}-
48+
cache: 'yarn'
6349

6450
- name: Restore nextjs build blog-app from cache
6551
uses: actions/cache@v2

.github/workflows/ci-packages.yml

+2-16
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,10 @@ jobs:
3939
- uses: actions/checkout@v2
4040

4141
- name: Use Node.js ${{ matrix.node-version }}
42-
uses: actions/setup-node@master
42+
uses: actions/setup-node@v2
4343
with:
4444
node-version: ${{ matrix.node-version }}
45-
46-
- name: Get yarn cache directory path
47-
id: yarn-cache-dir-path
48-
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
49-
50-
# Inspired by https://github.com/yarnpkg/berry/issues/954#issuecomment-629734719
51-
- name: Restore yarn cache
52-
uses: actions/cache@v2
53-
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
54-
with:
55-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
56-
key: yarn-cache-folder-os-${{ runner.os }}-node-${{ env.node-version }}-${{ hashFiles('**/yarn.lock') }}
57-
restore-keys: |
58-
yarn-cache-folder-os-${{ runner.os }}-node-${{ env.node-version }}-
59-
yarn-cache-folder-os-${{ runner.os }}-
45+
cache: 'yarn'
6046

6147
- name: Install dependencies
6248
run: |

.github/workflows/ci-web-app.yml

+2-16
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,10 @@ jobs:
4444
- uses: actions/checkout@v2
4545

4646
- name: Use Node.js ${{ matrix.node-version }}
47-
uses: actions/setup-node@master
47+
uses: actions/setup-node@v2
4848
with:
4949
node-version: ${{ matrix.node-version }}
50-
51-
- name: Get yarn cache directory path
52-
id: yarn-cache-dir-path
53-
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
54-
55-
# Inspired by https://github.com/yarnpkg/berry/issues/954#issuecomment-629734719
56-
- name: Restore yarn cache
57-
uses: actions/cache@v2
58-
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
59-
with:
60-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
61-
key: yarn-cache-folder-os-${{ runner.os }}-node-${{ env.node-version }}-${{ hashFiles('**/yarn.lock') }}
62-
restore-keys: |
63-
yarn-cache-folder-os-${{ runner.os }}-node-${{ env.node-version }}-
64-
yarn-cache-folder-os-${{ runner.os }}-
50+
cache: 'yarn'
6551

6652
- name: Restore nextjs build web-app from cache
6753
uses: actions/cache@v2

.github/workflows/release.yml

+3-16
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,12 @@ jobs:
1717
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
1818
fetch-depth: 0
1919

20+
2021
- name: Use Node.js 14.x
21-
uses: actions/setup-node@master
22+
uses: actions/setup-node@v2
2223
with:
2324
node-version: 14.x
24-
25-
- name: Get yarn cache directory path
26-
id: yarn-cache-dir-path
27-
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
28-
29-
# Inspired by https://github.com/yarnpkg/berry/issues/954#issuecomment-629734719
30-
- name: Restore yarn cache
31-
uses: actions/cache@v2
32-
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
33-
with:
34-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
35-
key: yarn-cache-folder-os-${{ runner.os }}-node-${{ env.node-version }}-${{ hashFiles('**/yarn.lock') }}
36-
restore-keys: |
37-
yarn-cache-folder-os-${{ runner.os }}-node-${{ env.node-version }}-
38-
yarn-cache-folder-os-${{ runner.os }}-
25+
cache: 'yarn'
3926

4027
- name: Install Dependencies
4128
run: yarn install --immutable

0 commit comments

Comments
 (0)