From 4990c43930bb7bb0b4ec858b05bdbe213df9b6ce Mon Sep 17 00:00:00 2001 From: Fabian Date: Tue, 25 Mar 2025 01:43:29 +0700 Subject: [PATCH] update package.json version earlier --- .github/workflows/ci.yml | 15 +++------------ Makefile | 3 +++ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ad8f305..b3fe19dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -115,6 +115,9 @@ jobs: - name: Run expect tests run: make expect-tests + - name: Update package.json version + run: make update-package-json-version + - name: Upload the artifact uses: actions/upload-artifact@v4 with: @@ -150,18 +153,6 @@ jobs: - name: Display structure of downloaded files run: ls -R - - name: Set package.json version - uses: actions/github-script@v7 - with: - result-encoding: string - script: | - const fs = require("fs"); - const { execFileSync } = require("child_process") - const version = execFileSync("git", ["describe", "--tags"], { encoding: "utf8" }).trim().replace("-", "."); - const pkg = { ...require("./package.json"), version }; - console.log(pkg); - fs.writeFileSync("package.json", JSON.stringify(pkg, null, " "), "utf8"); - - name: Release to GitHub uses: ncipollo/release-action@v1 with: diff --git a/Makefile b/Makefile index 00367671..35b4be0f 100644 --- a/Makefile +++ b/Makefile @@ -385,3 +385,6 @@ build/xterm.js: curl https://cdn.jsdelivr.net/npm/xterm@5.2.1/lib/xterm.min.js > build/xterm.js curl https://cdn.jsdelivr.net/npm/xterm@5.2.1/lib/xterm.js.map > build/xterm.js.map curl https://cdn.jsdelivr.net/npm/xterm@5.2.1/css/xterm.css > build/xterm.css + +update-package-json-version: + jq --arg version "$$(git describe --tags | sed 's/-/./' | tr - +)" '.version = $$version' package.json | sponge package.json