Skip to content

Commit 7f5d591

Browse files
code-asheryiliang114
authored andcommitted
Set Node version in a single place (coder#6534)
This should make it much easier to update. Also use 18.15.0 specifically since that is what VS Code ships with. Additionally, it fixes the post-install script being skipped due to a Yarn v1 bug that happens when Yarn installs node-gyp, which it does because 18.18 onward stopped bundling node-gyp.
1 parent 269fc74 commit 7f5d591

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

.github/workflows/build.yaml

+12-12
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ jobs:
5050
files: |
5151
docs/**
5252
53-
- name: Install Node.js v18
53+
- name: Install Node.js
5454
if: steps.changed-files.outputs.any_changed == 'true'
5555
uses: actions/setup-node@v4
5656
with:
57-
node-version: "18"
57+
node-version-file: .node-version
5858
cache: "yarn"
5959

6060
- name: Install doctoc
@@ -115,11 +115,11 @@ jobs:
115115
files_ignore: |
116116
lib/vscode/**
117117
118-
- name: Install Node.js v18
118+
- name: Install Node.js
119119
if: steps.changed-files.outputs.any_changed == 'true'
120120
uses: actions/setup-node@v4
121121
with:
122-
node-version: "18"
122+
node-version-file: .node-version
123123

124124
- name: Fetch dependencies from cache
125125
if: steps.changed-files.outputs.any_changed == 'true'
@@ -170,11 +170,11 @@ jobs:
170170
files_ignore: |
171171
lib/vscode/**
172172
173-
- name: Install Node.js v18
173+
- name: Install Node.js
174174
if: steps.changed-files.outputs.any_changed == 'true'
175175
uses: actions/setup-node@v4
176176
with:
177-
node-version: "18"
177+
node-version-file: .node-version
178178

179179
- name: Fetch dependencies from cache
180180
if: steps.changed-files.outputs.any_changed == 'true'
@@ -224,10 +224,10 @@ jobs:
224224
- name: Patch Code
225225
run: quilt push -a
226226

227-
- name: Install Node.js v18
227+
- name: Install Node.js
228228
uses: actions/setup-node@v4
229229
with:
230-
node-version: "18"
230+
node-version-file: .node-version
231231

232232
- name: Fetch dependencies from cache
233233
id: cache-node-modules
@@ -298,10 +298,10 @@ jobs:
298298
- name: Install system dependencies
299299
run: sudo apt update && sudo apt install -y libkrb5-dev
300300

301-
- name: Install Node.js v18
301+
- name: Install Node.js
302302
uses: actions/setup-node@v4
303303
with:
304-
node-version: "18"
304+
node-version-file: .node-version
305305

306306
- name: Fetch dependencies from cache
307307
id: cache-node-modules
@@ -357,10 +357,10 @@ jobs:
357357
- name: Install system dependencies
358358
run: sudo apt update && sudo apt install -y libkrb5-dev
359359

360-
- name: Install Node.js v18
360+
- name: Install Node.js
361361
uses: actions/setup-node@v4
362362
with:
363-
node-version: "18"
363+
node-version-file: .node-version
364364

365365
- name: Fetch dependencies from cache
366366
id: cache-node-modules

.github/workflows/publish.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ jobs:
2929
- name: Checkout code-server
3030
uses: actions/checkout@v4
3131

32-
- name: Install Node.js v18
32+
- name: Install Node.js
3333
uses: actions/setup-node@v4
3434
with:
35-
node-version: "18"
35+
node-version-file: .node-version
3636
cache: "yarn"
3737

3838
- name: Download npm package from release artifacts

.github/workflows/release.yaml

+9-9
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ jobs:
3535
- name: Checkout repo
3636
uses: actions/checkout@v4
3737

38-
- name: Install Node.js v18
38+
- name: Install Node.js
3939
uses: actions/setup-node@v4
4040
with:
41-
node-version: "18.15.0"
41+
node-version-file: .node-version
4242

4343
- name: Install development tools
4444
run: |
@@ -128,7 +128,6 @@ jobs:
128128
PKG_CONFIG_PATH: ${{ format('/usr/lib/{0}/pkgconfig', matrix.prefix) }}
129129
TARGET_ARCH: ${{ matrix.apt_arch }}
130130
npm_config_arch: ${{ matrix.npm_arch }}
131-
NODE_VERSION: v18.15.0
132131
# Not building from source results in an x86_64 argon2, as if
133132
# npm_config_arch is being ignored.
134133
npm_config_build_from_source: true
@@ -137,10 +136,10 @@ jobs:
137136
- name: Checkout repo
138137
uses: actions/checkout@v4
139138

140-
- name: Install Node.js v18
139+
- name: Install Node.js
141140
uses: actions/setup-node@v4
142141
with:
143-
node-version: "18.15.0"
142+
node-version-file: .node-version
144143

145144
- name: Install cross-compiler and system dependencies
146145
run: |
@@ -174,8 +173,9 @@ jobs:
174173

175174
- name: Replace node with cross-compile equivalent
176175
run: |
177-
wget https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-${npm_config_arch}.tar.xz
178-
tar -xf node-${NODE_VERSION}-linux-${npm_config_arch}.tar.xz node-${NODE_VERSION}-linux-${npm_config_arch}/bin/node --strip-components=2
176+
node_version=$(node --version)
177+
wget https://nodejs.org/dist/${node_version}/node-${node_version}-linux-${npm_config_arch}.tar.xz
178+
tar -xf node-${node_version}-linux-${npm_config_arch}.tar.xz node-${node_version}-linux-${npm_config_arch}/bin/node --strip-components=2
179179
mv ./node ./release-standalone/lib/node
180180
181181
# NOTE@jsjoeio - we do this so we can strip out the v
@@ -205,10 +205,10 @@ jobs:
205205
- name: Checkout repo
206206
uses: actions/checkout@v4
207207

208-
- name: Install Node.js v18
208+
- name: Install Node.js
209209
uses: actions/setup-node@v4
210210
with:
211-
node-version: "18.15.0"
211+
node-version-file: .node-version
212212

213213
- name: Install nfpm
214214
run: |

.github/workflows/security.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ jobs:
2929
with:
3030
fetch-depth: 0
3131

32-
- name: Install Node.js v18
32+
- name: Install Node.js
3333
uses: actions/setup-node@v4
3434
with:
35-
node-version: "18"
35+
node-version-file: .node-version
3636

3737
- name: Audit yarn for vulnerabilities
3838
run: yarn audit

.node-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18
1+
18.15.0

0 commit comments

Comments
 (0)