Skip to content

Commit 64c9343

Browse files
committed
chore: create an action to setup node
1 parent b8f11d3 commit 64c9343

File tree

7 files changed

+45
-66
lines changed

7 files changed

+45
-66
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: setup_node
2+
description: Setup Node, and install Pnpm
3+
inputs:
4+
node-version:
5+
required: false
6+
description: The version of Node to use.
7+
default: '22.x'
8+
runs:
9+
using: 'composite'
10+
steps:
11+
- name: Setup pnpm
12+
uses: pnpm/action-setup@v4
13+
14+
- name: Use Node.js ${{ inputs.node-version }}
15+
uses: actions/setup-node@v4.1.0
16+
with:
17+
registry-url: 'https://registry.npmjs.org'
18+
node-version: ${{ inputs.node-version }}
19+
cache: 'pnpm'
20+
21+
- name: Enable Corepack
22+
run: |
23+
npm i -g --force corepack
24+
corepack enable
25+
pnpm -v
26+
shell: bash

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,10 @@ updates:
1616
directory: '/'
1717
schedule:
1818
interval: 'daily'
19+
20+
- package-ecosystem: 'github-actions'
21+
# Workflow files stored in the
22+
# default location of `.github/workflows`
23+
directory: '/.github/actions/setup-node'
24+
schedule:
25+
interval: 'daily'

.github/workflows/lint.yml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,8 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v4
2323

24-
- name: Corepack Enable
25-
run: corepack enable
26-
27-
- name: Use Node.js
28-
uses: actions/setup-node@v4
29-
with:
30-
cache: 'pnpm'
31-
32-
- name: Corepack Enable
33-
run: |
34-
npm install -g --force corepack
35-
corepack enable
36-
37-
- name: Install
38-
run: pnpm install
24+
- name: Setup Node
25+
uses: ./.github/actions/setup-node
3926

4027
- name: lint
4128
run: pnpm run lint:ci

.github/workflows/release-please.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,10 @@ jobs:
3535
- name: Checkout code
3636
uses: actions/checkout@v4
3737

38-
- name: Corepack Enable
39-
run: corepack enable
40-
41-
- name: Use Node.js
42-
uses: actions/setup-node@v4
38+
- name: Setup Node
39+
uses: ./.github/actions/setup-node
4340
with:
4441
node-version: 18
45-
registry-url: 'https://registry.npmjs.org'
46-
cache: 'pnpm'
47-
48-
- name: Install / Build
49-
run: |
50-
pnpm install
5142

5243
- name: Publish
5344
env:

.github/workflows/test.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,10 @@ jobs:
2525
steps:
2626
- uses: actions/checkout@v4
2727

28-
- name: Corepack Enable
29-
run: |
30-
npm install -g corepack
31-
corepack enable
32-
33-
- name: Use Node.js ${{ matrix.node-version }}
34-
uses: actions/setup-node@v4
28+
- name: Setup Node
29+
uses: ./.github/actions/setup-node
3530
with:
3631
node-version: ${{ matrix.node-version }}
37-
cache: 'pnpm'
3832

3933
- run: pnpm install
4034
- run: pnpm test
@@ -53,14 +47,10 @@ jobs:
5347
steps:
5448
- uses: actions/checkout@v4
5549

56-
- name: Corepack Enable
57-
run: corepack enable
58-
59-
- name: Use Node.js ${{ matrix.node-version }}
60-
uses: actions/setup-node@v4
50+
- name: Setup Node
51+
uses: ./.github/actions/setup-node
6152
with:
6253
node-version: ${{ matrix.node-version }}
63-
cache: 'pnpm'
6454

6555
- run: pnpm install
6656
- run: pnpm test

.github/workflows/update-dependencies.yml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,8 @@ jobs:
3030
with:
3131
ref: ${{ env.REF_BRANCH }}
3232

33-
- name: Corepack Enable
34-
run: |
35-
npm install -g --force corepack
36-
corepack enable
37-
38-
- name: Use Node.js
39-
uses: actions/setup-node@v4
40-
with:
41-
cache: 'pnpm'
42-
43-
- name: Corepack Enable
44-
run: |
45-
npm install -g --force corepack
46-
corepack enable
33+
- name: Setup Node
34+
uses: ./.github/actions/setup-node
4735

4836
- name: Install
4937
run: pnpm install

.github/workflows/update-vscode.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,8 @@ jobs:
2929
with:
3030
ref: ${{ env.REF_BRANCH }}
3131

32-
- name: Corepack Enable
33-
run: corepack enable
34-
35-
- name: Use Node.js
36-
uses: actions/setup-node@v4
37-
with:
38-
cache: 'pnpm'
39-
40-
- name: Corepack Enable
41-
run: |
42-
npm install -g --force corepack
43-
corepack enable
32+
- name: Setup Node
33+
uses: ./.github/actions/setup-node
4434

4535
- name: Install
4636
run: pnpm install

0 commit comments

Comments
 (0)