Skip to content

Commit e5bfbaa

Browse files
authored
feat(dev): Add default Node version for CI jobs (#5081)
In our CI workflow, we currently use version 1 of GHA's `setup-node` action, whose default Node version is 10. Though we could (and should) update to version 3 of the action, whose default is Node 16, the `setup-node` docs[1] recommend explicitly setting a version for greater control and clarity. This does so, by adding the default Node version as an env variable and using it in all jobs which don't otherwise specify their version. [1] https://github.com/actions/setup-node#usage
1 parent 23982cf commit e5bfbaa

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

.github/workflows/build.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ on:
1212
required: false
1313

1414
env:
15+
DEFAULT_NODE_VERSION: '16'
16+
1517
HEAD_COMMIT: ${{ github.event.inputs.commit || github.sha }}
1618

1719
CACHED_DEPENDENCY_PATHS: |
@@ -45,6 +47,8 @@ jobs:
4547
ref: ${{ env.HEAD_COMMIT }}
4648
- name: Set up Node
4749
uses: actions/setup-node@v1
50+
with:
51+
node-version: ${{ env.DEFAULT_NODE_VERSION }}
4852
# we use a hash of yarn.lock as our cache key, because if it hasn't changed, our dependencies haven't changed,
4953
# so no need to reinstall them
5054
- name: Compute dependency cache key
@@ -74,6 +78,9 @@ jobs:
7478
ref: ${{ env.HEAD_COMMIT }}
7579
- name: Set up Node
7680
uses: actions/setup-node@v1
81+
with:
82+
# ember won't build under node 16, at least not with the versions of the ember build tools we use
83+
node-version: '14'
7784
- name: Check dependency cache
7885
uses: actions/cache@v2
7986
with:
@@ -110,7 +117,7 @@ jobs:
110117
- name: Set up Node
111118
uses: actions/setup-node@v1
112119
with:
113-
node-version: '12'
120+
node-version: ${{ env.DEFAULT_NODE_VERSION }}
114121
- name: Check dependency cache
115122
uses: actions/cache@v2
116123
with:
@@ -141,6 +148,8 @@ jobs:
141148
ref: ${{ env.HEAD_COMMIT }}
142149
- name: Set up Node
143150
uses: actions/setup-node@v1
151+
with:
152+
node-version: ${{ env.DEFAULT_NODE_VERSION }}
144153
- name: Check dependency cache
145154
uses: actions/cache@v2
146155
with:
@@ -166,6 +175,8 @@ jobs:
166175
ref: ${{ env.HEAD_COMMIT }}
167176
- name: Set up Node
168177
uses: actions/setup-node@v1
178+
with:
179+
node-version: ${{ env.DEFAULT_NODE_VERSION }}
169180
- name: Check dependency cache
170181
uses: actions/cache@v2
171182
with:
@@ -192,6 +203,8 @@ jobs:
192203
ref: ${{ env.HEAD_COMMIT }}
193204
- name: Set up Node
194205
uses: actions/setup-node@v1
206+
with:
207+
node-version: ${{ env.DEFAULT_NODE_VERSION }}
195208
- name: Check dependency cache
196209
uses: actions/cache@v2
197210
with:
@@ -359,7 +372,7 @@ jobs:
359372
- name: Set up Node
360373
uses: actions/setup-node@v1
361374
with:
362-
node-version: '16'
375+
node-version: ${{ env.DEFAULT_NODE_VERSION }}
363376
- name: Check dependency cache
364377
uses: actions/cache@v2
365378
with:
@@ -398,6 +411,8 @@ jobs:
398411
ref: ${{ env.HEAD_COMMIT }}
399412
- name: Set up Node
400413
uses: actions/setup-node@v1
414+
with:
415+
node-version: ${{ env.DEFAULT_NODE_VERSION }}
401416
- name: Check dependency cache
402417
uses: actions/cache@v2
403418
with:
@@ -430,7 +445,7 @@ jobs:
430445
- name: Set up Node
431446
uses: actions/setup-node@v1
432447
with:
433-
node-version: '16'
448+
node-version: ${{ env.DEFAULT_NODE_VERSION }}
434449
- name: Check dependency cache
435450
uses: actions/cache@v2
436451
with:

0 commit comments

Comments
 (0)