Skip to content

Commit 7c5fd23

Browse files
committed
Update pnpm setup for workflows
1 parent f884063 commit 7c5fd23

File tree

2 files changed

+43
-27
lines changed

2 files changed

+43
-27
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,33 @@ jobs:
3434
steps:
3535
- uses: actions/checkout@v2
3636

37-
- name: pnpm cache
38-
uses: actions/cache@v2
39-
env:
40-
cache-name: cache-pnpm-store
41-
with:
42-
path: ~/.pnpm-store
43-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node }}-${{ hashFiles('**/.package.json') }}
44-
restore-keys: |
45-
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node }}-
46-
4737
- uses: actions/setup-node@v1
4838
with:
4939
node-version: ${{ matrix.node }}
5040

51-
- name: pnpm setup
52-
uses: pnpm/[email protected]
41+
- name: Setup pnpm
42+
id: pnpm-install
43+
uses: pnpm/action-setup@v2
44+
with:
45+
version: 7
46+
run_install: false
47+
48+
- name: Get pnpm store directory
49+
id: pnpm-cache
50+
shell: bash
51+
run: |
52+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
53+
54+
- uses: actions/cache@v3
55+
name: Setup pnpm cache
5356
with:
54-
version: 6.2.1
55-
run_install: true
57+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
58+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
59+
restore-keys: |
60+
${{ runner.os }}-pnpm-store-
61+
62+
- name: Install dependencies
63+
run: pnpm i --frozen-lockfile
5664

5765
- run: pnpm run ci
5866

.github/workflows/eslint.yml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,33 @@ jobs:
2626
steps:
2727
- uses: actions/checkout@v2
2828

29-
- name: pnpm cache
30-
uses: actions/cache@v2
31-
env:
32-
cache-name: cache-pnpm-store
33-
with:
34-
path: ~/.pnpm-store
35-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node }}-${{ hashFiles('**/.package.json') }}
36-
restore-keys: |
37-
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node }}-
38-
3929
- name: Setup Node.js
4030
uses: actions/setup-node@v2
4131
with:
42-
node-version: 16
32+
node-version: 18
4333

4434
- name: Setup pnpm
35+
id: pnpm-install
4536
uses: pnpm/action-setup@v2
4637
with:
47-
version: 6.2.1
48-
run_install: true
38+
version: 7
39+
run_install: false
40+
41+
- name: Get pnpm store directory
42+
id: pnpm-cache
43+
shell: bash
44+
run: |
45+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
46+
47+
- uses: actions/cache@v3
48+
name: Setup pnpm cache
49+
with:
50+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
51+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
52+
restore-keys: |
53+
${{ runner.os }}-pnpm-store-
54+
55+
- name: Install dependencies
56+
run: pnpm i --frozen-lockfile
4957

5058
- run: pnpm run eslint

0 commit comments

Comments
 (0)