update package.json version earlier

This commit is contained in:
Fabian 2025-03-25 01:43:29 +07:00
parent 59ffdcb2dd
commit 4990c43930
2 changed files with 6 additions and 12 deletions

View file

@ -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:

View file

@ -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