From da254c39eec72b15ebe42336f70891f188f7bb59 Mon Sep 17 00:00:00 2001 From: Asher Date: Tue, 14 Nov 2023 12:45:56 -0900 Subject: [PATCH] Set Node version in a single place (#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. --- .github/workflows/build.yaml | 24 ++++++++++++------------ .github/workflows/publish.yaml | 4 ++-- .github/workflows/release.yaml | 18 +++++++++--------- .github/workflows/security.yaml | 4 ++-- .node-version | 2 +- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 73cf7117d..7fefaeb21 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -50,11 +50,11 @@ jobs: files: | docs/** - - name: Install Node.js v18 + - name: Install Node.js if: steps.changed-files.outputs.any_changed == 'true' uses: actions/setup-node@v4 with: - node-version: "18" + node-version-file: .node-version cache: "yarn" - name: Install doctoc @@ -115,11 +115,11 @@ jobs: files_ignore: | lib/vscode/** - - name: Install Node.js v18 + - name: Install Node.js if: steps.changed-files.outputs.any_changed == 'true' uses: actions/setup-node@v4 with: - node-version: "18" + node-version-file: .node-version - name: Fetch dependencies from cache if: steps.changed-files.outputs.any_changed == 'true' @@ -170,11 +170,11 @@ jobs: files_ignore: | lib/vscode/** - - name: Install Node.js v18 + - name: Install Node.js if: steps.changed-files.outputs.any_changed == 'true' uses: actions/setup-node@v4 with: - node-version: "18" + node-version-file: .node-version - name: Fetch dependencies from cache if: steps.changed-files.outputs.any_changed == 'true' @@ -224,10 +224,10 @@ jobs: - name: Patch Code run: quilt push -a - - name: Install Node.js v18 + - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: "18" + node-version-file: .node-version - name: Fetch dependencies from cache id: cache-node-modules @@ -298,10 +298,10 @@ jobs: - name: Install system dependencies run: sudo apt update && sudo apt install -y libkrb5-dev - - name: Install Node.js v18 + - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: "18" + node-version-file: .node-version - name: Fetch dependencies from cache id: cache-node-modules @@ -357,10 +357,10 @@ jobs: - name: Install system dependencies run: sudo apt update && sudo apt install -y libkrb5-dev - - name: Install Node.js v18 + - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: "18" + node-version-file: .node-version - name: Fetch dependencies from cache id: cache-node-modules diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index ab3572735..68b342fe7 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -29,10 +29,10 @@ jobs: - name: Checkout code-server uses: actions/checkout@v4 - - name: Install Node.js v18 + - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: "18" + node-version-file: .node-version cache: "yarn" - name: Download npm package from release artifacts diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3e63efa71..5fea41484 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -35,10 +35,10 @@ jobs: - name: Checkout repo uses: actions/checkout@v4 - - name: Install Node.js v18 + - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: "18.15.0" + node-version-file: .node-version - name: Install development tools run: | @@ -128,7 +128,6 @@ jobs: PKG_CONFIG_PATH: ${{ format('/usr/lib/{0}/pkgconfig', matrix.prefix) }} TARGET_ARCH: ${{ matrix.apt_arch }} npm_config_arch: ${{ matrix.npm_arch }} - NODE_VERSION: v18.15.0 # Not building from source results in an x86_64 argon2, as if # npm_config_arch is being ignored. npm_config_build_from_source: true @@ -137,10 +136,10 @@ jobs: - name: Checkout repo uses: actions/checkout@v4 - - name: Install Node.js v18 + - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: "18.15.0" + node-version-file: .node-version - name: Install cross-compiler and system dependencies run: | @@ -174,8 +173,9 @@ jobs: - name: Replace node with cross-compile equivalent run: | - wget https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-${npm_config_arch}.tar.xz - tar -xf node-${NODE_VERSION}-linux-${npm_config_arch}.tar.xz node-${NODE_VERSION}-linux-${npm_config_arch}/bin/node --strip-components=2 + node_version=$(node --version) + wget https://nodejs.org/dist/${node_version}/node-${node_version}-linux-${npm_config_arch}.tar.xz + tar -xf node-${node_version}-linux-${npm_config_arch}.tar.xz node-${node_version}-linux-${npm_config_arch}/bin/node --strip-components=2 mv ./node ./release-standalone/lib/node # NOTE@jsjoeio - we do this so we can strip out the v @@ -205,10 +205,10 @@ jobs: - name: Checkout repo uses: actions/checkout@v4 - - name: Install Node.js v18 + - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: "18.15.0" + node-version-file: .node-version - name: Install nfpm run: | diff --git a/.github/workflows/security.yaml b/.github/workflows/security.yaml index 3f9f5e191..9e052b570 100644 --- a/.github/workflows/security.yaml +++ b/.github/workflows/security.yaml @@ -29,10 +29,10 @@ jobs: with: fetch-depth: 0 - - name: Install Node.js v18 + - name: Install Node.js uses: actions/setup-node@v4 with: - node-version: "18" + node-version-file: .node-version - name: Audit yarn for vulnerabilities run: yarn audit diff --git a/.node-version b/.node-version index 3c032078a..55bffd620 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -18 +18.15.0