Skip to content

Commit f06eaf2

Browse files
authored
Use NPM caching built into action/setup-node (#33190)
As of version 2.2.2, caching for NPM dependencies is now built into the `action/setup-action` action. See https://github.blog/changelog/2021-07-02-github-actions-setup-node-now-supports-dependency-caching/ for more information. * Consistently include an empty line before `steps`. * Continue using the old caching method for the pull request workflow. The `npm install` runs for a separate directory, which could cause a very small subset of packages to be cached.
1 parent 138d5f1 commit f06eaf2

15 files changed

+34
-97
lines changed

.github/workflows/build-plugin-zip.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
outputs:
2525
current_stable_branch: ${{ steps.get_branches.outputs.current_stable_branch }}
2626
next_stable_branch: ${{ steps.get_branches.outputs.next_stable_branch }}
27+
2728
steps:
2829
- name: Get current and next stable release branches
2930
id: get_branches
@@ -63,6 +64,7 @@ jobs:
6364
old_version: ${{ steps.get_version.outputs.old_version }}
6465
new_version: ${{ steps.get_version.outputs.new_version }}
6566
release_branch: ${{ steps.get_version.outputs.release_branch }}
67+
6668
steps:
6769
- name: Checkout code
6870
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
@@ -155,16 +157,10 @@ jobs:
155157
ref: ${{ needs.bump-version.outputs.release_branch || github.ref }}
156158

157159
- name: Use desired version of NodeJS
158-
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
160+
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
159161
with:
160162
node-version: 14
161-
162-
- name: Cache NPM packages
163-
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
164-
with:
165-
# npm cache files are stored in `~/.npm` on Linux/macOS
166-
path: ~/.npm
167-
key: ${{ runner.os }}-node-14-npm-cache-${{ hashFiles('**/package-lock.json') }}
163+
cache: npm
168164

169165
- name: Build Gutenberg plugin ZIP file
170166
run: ./bin/build-plugin-zip.sh

.github/workflows/bundle-size.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,17 @@ jobs:
3838
strategy:
3939
matrix:
4040
node: ['14']
41+
4142
steps:
4243
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
4344
with:
4445
fetch-depth: 1
4546

4647
- name: Use desired version of NodeJS
47-
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
48+
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
4849
with:
4950
node-version: ${{ matrix.node }}
50-
51-
- name: Cache NPM packages
52-
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
53-
with:
54-
# npm cache files are stored in `~/.npm` on Linux/macOS
55-
path: ~/.npm
56-
key: ${{ runner.os }}-node-${{ matrix.node }}-npm-cache-${{ hashFiles('**/package-lock.json') }}
51+
cache: npm
5752

5853
- uses: preactjs/compressed-size-action@df6e03e187079aef959a2878311639c77b95ee2e # v2.2.0
5954
with:

.github/workflows/create-block.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,10 @@ jobs:
2626
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
2727

2828
- name: Use desired version of NodeJS
29-
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
29+
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
3030
with:
3131
node-version: ${{ matrix.node }}
32-
33-
- name: Cache NPM packages
34-
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
35-
with:
36-
# npm cache files are stored in `~/.npm` on Linux/macOS
37-
path: ~/.npm
38-
key: ${{ runner.os }}-node-${{ matrix.node }}-npm-cache-${{ hashFiles('**/package-lock.json') }}
32+
cache: npm
3933

4034
- name: npm install, build, format and lint
4135
run: |

.github/workflows/end2end-test.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,10 @@ jobs:
3030
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
3131

3232
- name: Use desired version of NodeJS
33-
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
33+
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
3434
with:
3535
node-version: ${{ matrix.node }}
36-
37-
- name: Cache NPM packages
38-
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
39-
with:
40-
# npm cache files are stored in `~/.npm` on Linux/macOS
41-
path: ~/.npm
42-
key: ${{ runner.os }}-node-${{ matrix.node }}-npm-cache-${{ hashFiles('**/package-lock.json') }}
36+
cache: npm
4337

4438
- name: Npm install and build
4539
run: |

.github/workflows/performance.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,10 @@ jobs:
2222
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
2323

2424
- name: Use desired version of NodeJS
25-
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
25+
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
2626
with:
2727
node-version: 14
28-
29-
- name: Cache NPM packages
30-
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
31-
with:
32-
# npm cache files are stored in `~/.npm` on Linux/macOS
33-
path: ~/.npm
34-
key: ${{ runner.os }}-node-14-npm-cache-${{ hashFiles('**/package-lock.json') }}
28+
cache: npm
3529

3630
- name: Npm install
3731
run: |

.github/workflows/pull-request-automation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
ref: trunk
2121

2222
- name: Use desired version of NodeJS
23-
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
23+
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
2424
with:
2525
node-version: ${{ matrix.node }}
2626

.github/workflows/rnmobile-android-runner.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,10 @@ jobs:
2828
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
2929

3030
- name: Use desired version of NodeJS
31-
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
31+
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
3232
with:
3333
node-version: ${{ matrix.node }}
34-
35-
- name: Cache NPM packages
36-
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
37-
with:
38-
# npm cache files are stored in `~/.npm` on Linux/macOS
39-
path: ~/.npm
40-
key: ${{ runner.os }}-node-${{ matrix.node }}-npm-cache-${{ hashFiles('**/package-lock.json') }}
34+
cache: npm
4135

4236
- run: npm ci
4337

.github/workflows/rnmobile-ios-runner.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,10 @@ jobs:
2626
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
2727

2828
- name: Use desired version of NodeJS
29-
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
29+
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
3030
with:
3131
node-version: ${{ matrix.node }}
32-
33-
- name: Cache NPM packages
34-
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
35-
with:
36-
# npm cache files are stored in `~/.npm` on Linux/macOS
37-
path: ~/.npm
38-
key: ${{ runner.os }}-node-${{ matrix.node }}-npm-cache-${{ hashFiles('**/package-lock.json') }}
32+
cache: npm
3933

4034
- run: npm ci
4135

.github/workflows/stale-issue-add-needs-testing.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ jobs:
77
stale:
88
runs-on: ubuntu-latest
99
if: ${{ github.repository == 'WordPress/gutenberg' }}
10+
1011
steps:
1112
- uses: actions/stale@996798eb71ef485dc4c7b4d3285842d714040c4a # v3.0.17
1213
with:

.github/workflows/stale-issue-mark-stale.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ jobs:
77
stale:
88
runs-on: ubuntu-latest
99
if: ${{ github.repository == 'WordPress/gutenberg' }}
10+
1011
steps:
1112
- uses: actions/stale@996798eb71ef485dc4c7b4d3285842d714040c4a # v3.0.17
1213
with:

0 commit comments

Comments
 (0)