Skip to content

Commit 234a37d

Browse files
authored
ci: use composite action for webpack persistent caching (#7077)
1 parent eee207d commit 234a37d

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Webpack persistent cache
2+
description: Cache webpack's persistent cache between builds.
3+
4+
outputs:
5+
cache-hit:
6+
description: Whether the cache was restored from the cache key.
7+
value: ${{ steps.build-webpack-persistent-cache.outputs.cache-hit }}
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- uses: actions/cache@v4
13+
id: build-webpack-persistent-cache
14+
with:
15+
path: node_modules/.cache
16+
key: build-${{ hashFiles('**/webpack.*.mjs') }}-${{ hashFiles('**/yarn.lock') }}
17+
restore-keys: |-
18+
build-${{ hashFiles('**/webpack.*.mjs') }}-${{ hashFiles('**/yarn.lock') }}
19+
build-${{ hashFiles('**/webpack.*.mjs') }}-

.github/workflows/deploy.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,7 @@ jobs:
2424
cache: yarn
2525

2626
- name: Enable webpack persistent caching
27-
uses: actions/cache@v4
28-
id: build-webpack-persistent-cache
29-
with:
30-
path: node_modules/.cache
31-
key: build-${{ hashFiles('**/webpack.*.mjs') }}-${{ hashFiles('**/yarn.lock') }}
32-
restore-keys: |-
33-
build-${{ hashFiles('**/webpack.*.mjs') }}-${{ hashFiles('**/yarn.lock') }}
34-
build-${{ hashFiles('**/webpack.*.mjs') }}-
27+
uses: ./.github/actions/webpack-persistent-cache
3528

3629
- run: yarn --frozen-lockfile
3730
- name: Build site

.github/workflows/testing.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,7 @@ jobs:
8282
- run: yarn
8383

8484
- name: Enable webpack persistent caching
85-
uses: actions/cache@v4
86-
id: build-webpack-persistent-cache
87-
with:
88-
path: node_modules/.cache
89-
key: build-${{ hashFiles('**/webpack.*.mjs') }}-${{ hashFiles('**/yarn.lock') }}
90-
restore-keys: |-
91-
build-${{ hashFiles('**/webpack.*.mjs') }}-${{ hashFiles('**/yarn.lock') }}
92-
build-${{ hashFiles('**/webpack.*.mjs') }}-
85+
uses: ./.github/actions/webpack-persistent-cache
9386

9487
- name: Cypress run
9588
uses: cypress-io/github-action@v6

0 commit comments

Comments
 (0)