Skip to content

Commit ae47d31

Browse files
authored
Replaced custom caching strategy with one built into @actions/setup-node (#102)
Co-authored-by: Isaac Lee <ijlee2@users.noreply.github.com>
1 parent da8840a commit ae47d31

File tree

1 file changed

+3
-45
lines changed

1 file changed

+3
-45
lines changed

.github/workflows/ci-cd.yml

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,11 @@ jobs:
2323
- name: Use Node.js ${{ env.NODE_VERSION }}
2424
uses: actions/setup-node@v2
2525
with:
26+
cache: 'yarn'
2627
node-version: ${{ env.NODE_VERSION }}
2728

28-
- name: Get Yarn cache path
29-
id: yarn-cache-dir-path
30-
run: echo "::set-output name=dir::$(yarn cache dir)"
31-
32-
- name: Cache Yarn cache and node_modules
33-
id: cache-dependencies
34-
uses: actions/cache@v2
35-
with:
36-
path: |
37-
${{ steps.yarn-cache-dir-path.outputs.dir }}
38-
node_modules
39-
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('**/yarn.lock') }}
40-
restore-keys: ${{ runner.os }}-${{ env.NODE_VERSION }}-
41-
4229
- name: Install dependencies
4330
run: yarn install --frozen-lockfile
44-
if: steps.cache-dependencies.outputs.cache-hit != 'true'
4531

4632
- name: Lint
4733
run: yarn lint
@@ -58,25 +44,11 @@ jobs:
5844
- name: Use Node.js ${{ env.NODE_VERSION }}
5945
uses: actions/setup-node@v2
6046
with:
47+
cache: 'yarn'
6148
node-version: ${{ env.NODE_VERSION }}
6249

63-
- name: Get Yarn cache path
64-
id: yarn-cache-dir-path
65-
run: echo "::set-output name=dir::$(yarn cache dir)"
66-
67-
- name: Cache Yarn cache and node_modules
68-
id: cache-dependencies
69-
uses: actions/cache@v2
70-
with:
71-
path: |
72-
${{ steps.yarn-cache-dir-path.outputs.dir }}
73-
node_modules
74-
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('**/yarn.lock') }}
75-
restore-keys: ${{ runner.os }}-${{ env.NODE_VERSION }}-
76-
7750
- name: Install dependencies
7851
run: yarn install --frozen-lockfile
79-
if: steps.cache-dependencies.outputs.cache-hit != 'true'
8052

8153
- name: Test
8254
run: npx percy exec -- yarn test
@@ -110,25 +82,11 @@ jobs:
11082
- name: Use Node.js ${{ env.NODE_VERSION }}
11183
uses: actions/setup-node@v2
11284
with:
85+
cache: 'yarn'
11386
node-version: ${{ env.NODE_VERSION }}
11487

115-
- name: Get Yarn cache path
116-
id: yarn-cache-dir-path
117-
run: echo "::set-output name=dir::$(yarn cache dir)"
118-
119-
- name: Cache Yarn cache and node_modules
120-
id: cache-dependencies
121-
uses: actions/cache@v2
122-
with:
123-
path: |
124-
${{ steps.yarn-cache-dir-path.outputs.dir }}
125-
node_modules
126-
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('**/yarn.lock') }}
127-
restore-keys: ${{ runner.os }}-${{ env.NODE_VERSION }}-
128-
12988
- name: Install dependencies
13089
run: yarn install --frozen-lockfile
131-
if: steps.cache-dependencies.outputs.cache-hit != 'true'
13290

13391
- name: Deploy
13492
run: yarn deploy

0 commit comments

Comments
 (0)