Skip to content

Commit 427ca0c

Browse files
committed
Build: Improve CI caching
Changes: 1. Update from Node.js 20 to 24. 2. Use cache settings built into `actions/setup-node`, drop `actions/cache` - it is simpler to maintain that way and it fixes Windows-specific issues. 3. Switch from `npm install` to `npm ci` in CI.
1 parent 4c818ab commit 427ca0c

File tree

1 file changed

+10
-28
lines changed

1 file changed

+10
-28
lines changed

.github/workflows/node.js.yml

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ permissions:
1212
contents: read
1313

1414
env:
15-
NODE_VERSION: 20.x
15+
NODE_VERSION: 24.x
1616

1717
jobs:
1818
build-and-test:
@@ -31,17 +31,11 @@ jobs:
3131
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
3232
with:
3333
node-version: ${{ env.NODE_VERSION }}
34-
35-
- name: Cache
36-
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
37-
with:
38-
path: ~/.npm
39-
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
40-
restore-keys: |
41-
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
34+
cache: npm
35+
cache-dependency-path: '**/package-lock.json'
4236

4337
- name: Install npm dependencies
44-
run: npm install
38+
run: npm ci
4539

4640
- name: Build
4741
run: npm run build
@@ -67,17 +61,11 @@ jobs:
6761
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
6862
with:
6963
node-version: ${{ env.NODE_VERSION }}
70-
71-
- name: Cache
72-
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
73-
with:
74-
path: ~/.npm
75-
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
76-
restore-keys: |
77-
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
64+
cache: npm
65+
cache-dependency-path: '**/package-lock.json'
7866

7967
- name: Install dependencies
80-
run: npm install
68+
run: npm ci
8169

8270
- name: Build
8371
run: npm run build
@@ -103,17 +91,11 @@ jobs:
10391
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
10492
with:
10593
node-version: ${{ env.NODE_VERSION }}
106-
107-
- name: Cache
108-
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
109-
with:
110-
path: ~/.npm
111-
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
112-
restore-keys: |
113-
${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
94+
cache: npm
95+
cache-dependency-path: '**/package-lock.json'
11496

11597
- name: Install dependencies
116-
run: npm install
98+
run: npm ci
11799

118100
- name: Build
119101
run: npm run build

0 commit comments

Comments
 (0)