Skip to content

Commit 3621797

Browse files
committed
setup-node action with pnpm
0 parents  commit 3621797

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Setup Node
2+
3+
Lockas custom locka/setup-node command which uses corepack and pnpm to do quick instlal
4+
5+
## workflow.yaml
6+
7+
```yaml
8+
- uses: locka/setup-node@v1
9+
with:
10+
node-version: '20'
11+
```

action.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: 'Setup Node.js environment'
2+
description: 'Installs node 20 and fetched pnpm cache, then runs pnpm install'
3+
author: 'leon'
4+
inputs:
5+
node-version:
6+
description: 'Version Spec of the version to use. Examples: 20.x, 20.4.0, >=20.0.0'
7+
default: '20'
8+
9+
runs:
10+
using: 'composite'
11+
steps:
12+
- name: Enable NPM Corepack
13+
shell: bash
14+
run: corepack enable
15+
16+
- name: Use node.js 20
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: ${{ inputs.node-version }}
20+
21+
- name: Get pnpm store directory
22+
id: pnpm-cache
23+
shell: bash
24+
run: echo "PNPM_STORE_PATH=$(pnpm store path)" >> $GITHUB_ENV
25+
26+
- uses: actions/cache@v4
27+
name: Setup pnpm cache
28+
with:
29+
path: |
30+
${{ env.PNPM_STORE_PATH }}
31+
~/cache
32+
~/.cache
33+
!~/cache/exclude
34+
!~/.cache/exclude
35+
key: ${{ runner.os }}-node20-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
36+
restore-keys: ${{ runner.os }}-node20-pnpm-store-
37+
38+
- name: Install dependencies
39+
shell: bash
40+
run: pnpm install --frozen-lockfile

0 commit comments

Comments
 (0)