Skip to content

Commit 01b9b29

Browse files
committed
ci: move setup step to own action
1 parent 5ffd5c5 commit 01b9b29

File tree

3 files changed

+34
-38
lines changed

3 files changed

+34
-38
lines changed

.github/actions/setup/action.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Setup
2+
description: Setup Node.js and install dependencies
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Setup Node.js
8+
uses: actions/setup-node@v3
9+
with:
10+
node-version: 16.x
11+
12+
- name: Restore yarn cache
13+
id: yarn-cache
14+
uses: actions/cache@v3
15+
with:
16+
path: |
17+
'**/node_modules'
18+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
19+
restore-keys: |
20+
${{ runner.os }}-yarn-
21+
22+
- name: Install dependencies
23+
if: steps.yarn-cache.outputs.cache-hit != 'true'
24+
run: yarn install --frozen-lockfile
25+
shell: bash

.github/workflows/build-templates.yml

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,8 @@ jobs:
5959
- name: Checkout
6060
uses: actions/checkout@v3
6161

62-
- name: Setup Node.js
63-
uses: actions/[email protected]
64-
with:
65-
node-version: 16.x
66-
cache: yarn
67-
68-
- name: Cache project dependencies
69-
id: root-yarn-cache
70-
uses: actions/cache@v3
71-
with:
72-
path: |
73-
**/node_modules
74-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
75-
76-
- name: Install dependencies
77-
if: steps.root-yarn-cache.outputs.cache-hit != 'true'
78-
run: |
79-
yarn install --frozen-lockfile
62+
- name: Setup
63+
uses: ./.github/actions/setup
8064

8165
- name: Build package
8266
run: |
@@ -110,6 +94,8 @@ jobs:
11094
path: |
11195
${{ env.work_dir }}/**/node_modules
11296
key: ${{ runner.os }}-library-yarn-${{ hashFiles(format('{0}/**/package.json', env.work_dir)) }}
97+
restore-keys: |
98+
${{ runner.os }}-library-yarn-
11399
114100
- name: Install dependencies of library
115101
if: steps.library-yarn-cache.outputs.cache-hit != 'true'

.github/workflows/check-project.yml

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,14 @@ jobs:
99
- name: Checkout
1010
uses: actions/checkout@v3
1111

12-
- name: Setup Node.js
13-
uses: actions/setup-node@v3
14-
with:
15-
node-version: 16.x
16-
cache: yarn
17-
18-
- name: Cache dependencies
19-
id: yarn-cache
20-
uses: actions/cache@v3
21-
with:
22-
path: |
23-
**/node_modules
24-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
25-
26-
- name: Install dependencies
27-
if: steps.yarn-cache.outputs.cache-hit != 'true'
28-
run: yarn install --frozen-lockfile
12+
- name: Setup
13+
uses: ./.github/actions/setup
2914

3015
- name: Lint
3116
run: yarn lint
3217

33-
- name: Build packages
34-
run: yarn lerna run prepare
35-
3618
- name: Typecheck
3719
run: yarn typescript
20+
21+
- name: Build packages
22+
run: yarn lerna run prepare

0 commit comments

Comments
 (0)