diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml index 6eef1ca9..ea480bdb 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/build_and_test.yaml @@ -97,7 +97,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version-file: package.json + node-version-file: .node-version cache: "yarn" - name: Install Deps diff --git a/.github/workflows/build_linux.yaml b/.github/workflows/build_linux.yaml index 45ca5379..7f434dd3 100644 --- a/.github/workflows/build_linux.yaml +++ b/.github/workflows/build_linux.yaml @@ -76,7 +76,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version-file: package.json + node-version-file: .node-version cache: "yarn" env: # Workaround for https://github.com/actions/setup-node/issues/317 @@ -98,7 +98,7 @@ jobs: uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6 if: steps.changed_files.outputs.any_modified == 'true' with: - context: dockerbuild + file: dockerbuild/Dockerfile load: true platforms: linux/${{ inputs.arch }} tags: ${{ env.HAK_DOCKER_IMAGE }} diff --git a/.github/workflows/build_macos.yaml b/.github/workflows/build_macos.yaml index 344a1a90..4438dc48 100644 --- a/.github/workflows/build_macos.yaml +++ b/.github/workflows/build_macos.yaml @@ -62,7 +62,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version-file: package.json + node-version-file: .node-version cache: "yarn" - name: Install Deps diff --git a/.github/workflows/build_prepare.yaml b/.github/workflows/build_prepare.yaml index bd00f306..4a28f26a 100644 --- a/.github/workflows/build_prepare.yaml +++ b/.github/workflows/build_prepare.yaml @@ -56,7 +56,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version-file: package.json + node-version-file: .node-version cache: "yarn" - name: Install Deps diff --git a/.github/workflows/build_windows.yaml b/.github/workflows/build_windows.yaml index 09b5ed69..cb7c318a 100644 --- a/.github/workflows/build_windows.yaml +++ b/.github/workflows/build_windows.yaml @@ -99,9 +99,7 @@ jobs: - uses: actions/setup-node@v4 with: - # node-version-file: package.json - # For https://github.com/element-hq/element-desktop/issues/2161 - node-version: 22.13.1 + node-version-file: .node-version cache: "yarn" - name: Install Deps diff --git a/.github/workflows/dockerbuild.yaml b/.github/workflows/dockerbuild.yaml index 029ae64e..d2af9801 100644 --- a/.github/workflows/dockerbuild.yaml +++ b/.github/workflows/dockerbuild.yaml @@ -32,7 +32,7 @@ jobs: - name: Build test image uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6 with: - context: dockerbuild + file: dockerbuild/Dockerfile push: false load: true tags: element-desktop-dockerbuild @@ -63,7 +63,7 @@ jobs: if: github.event_name != 'pull_request' uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6 with: - context: dockerbuild + file: dockerbuild/Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/.node-version b/.node-version new file mode 100644 index 00000000..43779377 --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +v22.13.1 \ No newline at end of file diff --git a/dockerbuild/Dockerfile b/dockerbuild/Dockerfile index 89754a65..0c4c0b3c 100644 --- a/dockerbuild/Dockerfile +++ b/dockerbuild/Dockerfile @@ -21,8 +21,7 @@ ENV FORCE_COLOR true WORKDIR /project -ENV NODE_VERSION 20.18.2 ARG TARGETOS ARG TARGETARCH -COPY setup.sh /setup.sh +COPY .node-version dockerbuild/setup.sh / RUN /setup.sh diff --git a/dockerbuild/setup.sh b/dockerbuild/setup.sh index 96161210..efb43108 100755 --- a/dockerbuild/setup.sh +++ b/dockerbuild/setup.sh @@ -3,5 +3,6 @@ set -x declare -A archMap=(["amd64"]="x64" ["arm64"]="arm64") ARCH="${archMap["$TARGETARCH"]}" -curl --proto "=https" -L "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-$TARGETOS-$ARCH.tar.gz" | tar xz -C /usr/local --strip-components=1 && \ +NODE_VERSION=$(cat /.node-version) +curl --proto "=https" -L "https://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-$TARGETOS-$ARCH.tar.gz" | tar xz -C /usr/local --strip-components=1 && \ unlink /usr/local/CHANGELOG.md && unlink /usr/local/LICENSE && unlink /usr/local/README.md diff --git a/package.json b/package.json index 83cd04b3..c40c2a74 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "type": "module", "files": [], "engines": { - "node": ">=18.0.0" + "node": ">=18.0.0 <=22.13.1 || >22" }, "scripts": { "i18n": "matrix-gen-i18n && yarn i18n:sort && yarn i18n:lint", @@ -44,7 +44,7 @@ "build": "yarn run build:ts && yarn run build:res && electron-builder", "build:ts": "tsc", "build:res": "tsx scripts/copy-res.ts", - "docker:setup": "docker build --platform linux/amd64 -t element-desktop-dockerbuild dockerbuild", + "docker:setup": "docker build --platform linux/amd64 -t element-desktop-dockerbuild -f dockerbuild/Dockerfile .", "docker:build:native": "scripts/in-docker.sh yarn run hak", "docker:build": "scripts/in-docker.sh yarn run build", "docker:install": "scripts/in-docker.sh yarn install",