Skip to content

Commit 808f64a

Browse files
authored
ci: set pnpm cache key (openwallet-foundation#1919)
1 parent df5f26f commit 808f64a

File tree

1 file changed

+36
-8
lines changed

1 file changed

+36
-8
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,29 @@ jobs:
9595
- name: Checkout credo
9696
uses: actions/checkout@v4
9797

98+
- name: Setup NodeJS
99+
id: setup-node
100+
uses: actions/setup-node@v4
101+
with:
102+
node-version: ${{ matrix.node-version }}
103+
98104
- uses: pnpm/action-setup@v2
99105
with:
100106
version: 9.1.0
101107

102-
- name: Setup NodeJS
103-
uses: actions/setup-node@v4
108+
# See https://github.com/actions/setup-node/issues/641#issuecomment-1358859686
109+
- name: pnpm cache path
110+
id: pnpm-cache-path
111+
run: |
112+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
113+
114+
- name: pnpm cache
115+
uses: actions/cache@v3
104116
with:
105-
node-version: ${{ matrix.node-version }}
106-
cache: 'pnpm'
117+
path: ${{ steps.pnpm-cache-path.outputs.STORE_PATH }}
118+
key: ${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
119+
restore-keys: |
120+
${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-pnpm-store-
107121
108122
- name: Install dependencies
109123
run: pnpm install --frozen-lockfile
@@ -136,15 +150,29 @@ jobs:
136150
- name: Setup services
137151
run: docker compose up -d
138152

153+
- name: Setup NodeJS
154+
id: setup-node
155+
uses: actions/setup-node@v4
156+
with:
157+
node-version: ${{ matrix.node-version }}
158+
139159
- uses: pnpm/action-setup@v2
140160
with:
141161
version: 9.1.0
142162

143-
- name: Setup NodeJS
144-
uses: actions/setup-node@v4
163+
# See https://github.com/actions/setup-node/issues/641#issuecomment-1358859686
164+
- name: pnpm cache path
165+
id: pnpm-cache-path
166+
run: |
167+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
168+
169+
- name: pnpm cache
170+
uses: actions/cache@v3
145171
with:
146-
node-version: ${{ matrix.node-version }}
147-
cache: 'pnpm'
172+
path: ${{ steps.pnpm-cache-path.outputs.STORE_PATH }}
173+
key: ${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
174+
restore-keys: |
175+
${{ runner.os }}-${{ steps.setup-node.outputs.node-version }}-pnpm-store-
148176
149177
- name: Install dependencies
150178
run: pnpm install --frozen-lockfile

0 commit comments

Comments
 (0)