File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments