Skip to content

Commit 2b5ec6f

Browse files
committed
refactor workflows
1 parent be6a6e5 commit 2b5ec6f

File tree

3 files changed

+31
-46
lines changed

3 files changed

+31
-46
lines changed

.github/actions/setup/action.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: "Setup Environment"
2+
description: "Checkout, setup node, restore cache, install dependencies"
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- uses: actions/checkout@v4
8+
9+
- uses: actions/setup-node@v4
10+
with:
11+
node-version: 20
12+
cache: pnpm
13+
14+
- uses: actions/cache@v4
15+
id: pnpm-cache
16+
with:
17+
path: '**/node_modules'
18+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
19+
restore-keys: |
20+
${{ runner.os }}-pnpm-
21+
22+
- name: Install dependencies
23+
run: pnpm install

.github/workflows/release.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,17 @@
11
name: Release
2+
23
on:
34
push:
45
branches:
56
- master
67
- next
78
- beta
9+
810
jobs:
911
release:
1012
runs-on: ubuntu-latest
1113
steps:
12-
- uses: actions/checkout@v4
13-
- uses: actions/setup-node@v4
14-
with:
15-
node-version: 20
16-
cache: pnpm
17-
- uses: actions/cache@v3
18-
id: pnpm-cache
19-
with:
20-
path: node_modules
21-
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
22-
restore-keys: ${{ runner.os }}-pnpm-
23-
24-
- name: Install dependencies
25-
run: pnpm install --frozen-lockfile
14+
- uses: ./.github/actions/setup
2615

2716
- name: Test
2817
run: pnpm test

.github/workflows/test.yml

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,7 @@ jobs:
1010
test:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v4
14-
- uses: actions/setup-node@v4
15-
with:
16-
node-version: 20
17-
cache: pnpm
18-
- uses: actions/cache@v4
19-
id: pnpm-cache
20-
with:
21-
path: node_modules
22-
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
23-
restore-keys: ${{ runner.os }}-pnpm-
24-
25-
- name: Install dependencies
26-
run: pnpm install
13+
- uses: ./.github/actions/setup
2714

2815
- name: Test with Coverage
2916
run: pnpm run coverage
@@ -32,27 +19,14 @@ jobs:
3219
run: pnpm run eslint
3320

3421
- name: Report Coverage
35-
uses: coverallsapp/github-action@master
22+
uses: coverallsapp/github-action@v2
3623
with:
3724
github-token: ${{ secrets.GITHUB_TOKEN }}
3825

3926
build:
40-
runs-on: ubuntu-18.04
27+
runs-on: ubuntu-latest
4128
steps:
42-
- uses: actions/checkout@v3
43-
- uses: actions/setup-node@v3
44-
with:
45-
node-version: 16
46-
cache: pnpm
47-
- uses: actions/cache@v3
48-
id: pnpm-cache
49-
with:
50-
path: '**/node_modules'
51-
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
52-
restore-keys: ${{ runner.os }}-pnpm-
53-
54-
- name: Install dependencies
55-
run: pnpm install --frozen-lockfile --prefer-offline
29+
- uses: ./.github/actions/setup
5630

5731
- name: Build Dist
5832
run: pnpm build
@@ -61,5 +35,4 @@ jobs:
6135
run: npx bundlewatch
6236

6337
- name: Build Docs
64-
run: |
65-
npm run build:docs
38+
run: npm run build:docs

0 commit comments

Comments
 (0)