Skip to content

Commit d0d19ee

Browse files
committed
refactor: add composite action
Signed-off-by: Adam Setch <adam.setch@outlook.com>
1 parent 029736b commit d0d19ee

6 files changed

Lines changed: 30 additions & 56 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# This is the composite action:
2+
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
3+
4+
name: Setup Node, pnpm and install dependencies
5+
description: Setup pnpm and Node.js with caching
6+
7+
runs:
8+
using: composite
9+
steps:
10+
- name: Setup pnpm
11+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
12+
13+
- name: Setup Node
14+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
15+
with:
16+
node-version-file: .nvmrc
17+
cache: pnpm
18+
19+
- name: Install dependencies
20+
run: pnpm install --frozen-lockfile
21+
shell: bash

.github/workflows/build.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,8 @@ jobs:
3333
- name: Checkout
3434
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
3535

36-
- name: Setup pnpm
37-
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
38-
39-
- name: Setup Node
40-
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
41-
with:
42-
node-version-file: .nvmrc
43-
cache: pnpm
44-
45-
- name: Install dependencies
46-
run: pnpm install --frozen-lockfile
36+
- name: Setup Node.js
37+
uses: ./.github/actions/setup-node
4738

4839
- name: Build application
4940
run: pnpm build

.github/workflows/lint.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,8 @@ jobs:
1515
- name: Checkout
1616
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
1717

18-
- name: Setup pnpm
19-
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
20-
21-
- name: Setup Node
22-
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
23-
with:
24-
node-version-file: .nvmrc
25-
cache: pnpm
26-
27-
- name: Install dependencies
28-
run: pnpm install --frozen-lockfile
18+
- name: Setup Node.js
19+
uses: ./.github/actions/setup-node
2920

3021
- name: Run linter
3122
run: pnpm lint:check

.github/workflows/publish.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,8 @@ jobs:
3434
- name: Checkout
3535
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
3636

37-
- name: Setup pnpm
38-
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
39-
40-
- name: Setup Node
41-
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
42-
with:
43-
node-version-file: .nvmrc
44-
cache: pnpm
45-
46-
- name: Install dependencies
47-
run: pnpm install --frozen-lockfile
37+
- name: Setup Node.js
38+
uses: ./.github/actions/setup-node
4839

4940
- name: Build application
5041
run: pnpm build

.github/workflows/test.yml

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,7 @@ jobs:
1515
- name: Checkout
1616
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
1717

18-
- name: Setup pnpm
19-
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
20-
21-
- name: Setup Node
22-
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
23-
with:
24-
node-version-file: .nvmrc
25-
cache: pnpm
26-
27-
- name: Install dependencies
28-
run: pnpm install --frozen-lockfile
18+
- uses: ./.github/actions/setup-node
2919

3020
- name: Check TypeScript
3121
run: pnpm tsc --noEmit
@@ -52,17 +42,8 @@ jobs:
5242
with:
5343
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
5444

55-
- name: Setup pnpm
56-
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
57-
58-
- name: Setup Node
59-
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
60-
with:
61-
node-version-file: .nvmrc
62-
cache: pnpm
63-
64-
- name: Install dependencies
65-
run: pnpm install --frozen-lockfile
45+
- name: Setup Node.js
46+
uses: ./.github/actions/setup-node
6647

6748
- name: Download a single artifact
6849
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0

.husky/pre-commit

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)