Skip to content

Commit f42e3bd

Browse files
committed
init
0 parents  commit f42e3bd

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Setup Node and pnpm
2+
3+
* Reads node version file (.node-version) from project root
4+
* Only saves pnpm cache on the main branch
5+
* Restores pnpm cache on PR

action.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Setup Node and pnpm
2+
3+
runs:
4+
using: composite
5+
steps:
6+
- uses: pnpm/action-setup@v4
7+
8+
- uses: actions/setup-node@v4
9+
with:
10+
node-version-file: .node-version
11+
registry-url: 'https://registry.npmjs.org'
12+
# see pnpm cache setting below
13+
14+
- name: Get pnpm store directory
15+
id: store
16+
shell: bash
17+
run: |
18+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
19+
20+
- name: Save and restore pnpm cache on main
21+
uses: actions/cache@v4
22+
if: ${{ github.ref_name == 'main' }}
23+
with:
24+
path: ${{ steps.store.outputs.STORE_PATH }}
25+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
26+
restore-keys: |
27+
${{ runner.os }}-pnpm-store-
28+
29+
- name: Restore pnpm cache on PR
30+
uses: actions/cache/restore@v4
31+
if: ${{ github.ref_name != 'main' }}
32+
with:
33+
path: ${{ steps.store.outputs.STORE_PATH }}
34+
key: |
35+
${{ runner.os }}-pnpm-store-
36+
37+
- run: pnpm install --frozen-lockfile --ignore-scripts
38+
shell: bash

0 commit comments

Comments
 (0)