Skip to content

Commit f2716d4

Browse files
committed
feat(ci): add node-pnpm action
1 parent b0bb81a commit f2716d4

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Setup node & pnpm
2+
3+
inputs:
4+
node_version:
5+
description: "Node.js version"
6+
type: number
7+
required: true
8+
pnpm_version:
9+
description: "Pnpm version"
10+
required: true
11+
12+
runs:
13+
using: "composite"
14+
steps:
15+
- name: Setup Node
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: ${{ inputs.node_version }}
19+
20+
- uses: pnpm/action-setup@v4
21+
name: Install pnpm
22+
id: pnpm-install
23+
with:
24+
version: ${{ inputs.pnpm_version }}
25+
26+
- name: Get pnpm store directory
27+
id: pnpm-cache
28+
shell: bash
29+
run: |
30+
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
31+
32+
- name: Cache .pnpm-store
33+
uses: actions/cache@v4
34+
with:
35+
path: |
36+
${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
37+
# Generate a new cache whenever packages or source files change.
38+
key: |
39+
linux-OS-node-v${{inputs.node_version }}-pnpm-v${{inputs.pnpm_version}}-${{ hashFiles('**/pnpm-lock.yaml') }}
40+
restore-keys: |
41+
linux-OS-node-v${{inputs.node_version }}-pnpm-v${{inputs.pnpm_version}}-${{ hashFiles('**/pnpm-lock.yaml') }}
42+
43+
- name: Install packages
44+
shell: bash
45+
run: pnpm install --frozen-lockfile

0 commit comments

Comments
 (0)