From 2471add00bb65f1f81bce696ebff1c636330d190 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 3 Sep 2026 15:47:30 +0000 Subject: [PATCH] build: four-part releaseVersion (2.0.0.1) injected at packaging time electron-builder refuses a non-semver package.json version, so the published number lives in package.json releaseVersion and scripts/dist.mjs passes it as extraMetadata.version (plus the hotfix digit as Windows build number). The workflow tags and names the release from the same field. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_017Wn5VX9HNbJ7N54hR24u9Y --- .github/workflows/windows-release.yml | 4 ++-- README.md | 4 ++-- package.json | 5 +++-- scripts/dist.mjs | 16 ++++++++++++++++ 4 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 scripts/dist.mjs diff --git a/.github/workflows/windows-release.yml b/.github/workflows/windows-release.yml index 140edbf..3b19fac 100644 --- a/.github/workflows/windows-release.yml +++ b/.github/workflows/windows-release.yml @@ -43,7 +43,7 @@ jobs: id: ver shell: bash run: | - version=$(node -p "require('./package.json').version") + version=$(node -p "const p=require('./package.json'); p.releaseVersion || p.version") echo "version=$version" >> "$GITHUB_OUTPUT" # Fourth component (hotfix number, e.g. 2.0.0.1) becomes the Windows file build number. echo "build=$(echo "$version" | cut -d. -f4)" >> "$GITHUB_OUTPUT" @@ -54,7 +54,7 @@ jobs: fi - run: npm run build - name: Package Windows EXE - run: npx electron-builder --win --publish never + run: npm run dist -- --win --publish never env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_NUMBER: ${{ steps.ver.outputs.build }} diff --git a/README.md b/README.md index f05336e..e1c4440 100644 --- a/README.md +++ b/README.md @@ -96,13 +96,13 @@ npm run typecheck # renderer + main process Sans Electron, `npm run dev` puis `http://127.0.0.1:5173/` (ou `?mode=compact`) permet de travailler l'interface dans un navigateur ; les appels réseau passent alors directement par `fetch` (CORS requis côté serveur). -## Packaging Windows +## Packaging Windows et versions ```bash npm run dist ``` -L'installateur NSIS est produit dans `out/`. Le workflow GitHub Actions construit l'exécutable sur chaque tag `v*`. +L'installateur NSIS est produit dans `out/`. Le numéro de version publié est `releaseVersion` dans `package.json` (quatre chiffres, ex. `2.0.0.1` : le quatrième chiffre sert aux petits correctifs). `version` reste la base à trois chiffres exigée par electron-builder. À chaque fusion sur master, le workflow GitHub Actions crée le tag et la release Windows si ce numéro n'a pas encore été publié. --- diff --git a/package.json b/package.json index 315430a..4b4a112 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "eveflow", - "version": "2.0.0.1", + "version": "2.0.0", + "releaseVersion": "2.0.0.1", "description": "JARVIS-style desktop HUD for Hermes Agent: voice, streaming runs, scheduled jobs, skills and telemetry", "main": "dist-electron/main.js", "private": true, @@ -16,7 +17,7 @@ "electron": "electron .", "start": "npm run build:electron && concurrently -k -s first \"npm run dev\" \"wait-on http://127.0.0.1:5173 && cross-env NODE_ENV=development VITE_DEV_SERVER_URL=http://127.0.0.1:5173 electron .\"", "preview": "vite preview", - "dist": "npm run build && electron-builder --win --publish never", + "dist": "node scripts/dist.mjs", "typecheck:electron": "tsc -p tsconfig.electron.json --noEmit" }, "build": { diff --git a/scripts/dist.mjs b/scripts/dist.mjs new file mode 100644 index 0000000..a32c923 --- /dev/null +++ b/scripts/dist.mjs @@ -0,0 +1,16 @@ +// Packages the app with electron-builder using the four-part release version +// (package.json "releaseVersion", e.g. 2.0.0.1). package.json "version" must stay semver. +import { spawnSync } from 'node:child_process'; +import { readFileSync } from 'node:fs'; + +const pkg = JSON.parse(readFileSync('package.json', 'utf8')); +const release = pkg.releaseVersion || pkg.version; +const build = release.split('.')[3] ?? '0'; +const args = process.argv.slice(2); +if (!args.some((a) => a.startsWith('--win') || a.startsWith('--linux') || a.startsWith('--mac'))) args.unshift('--win'); +const result = spawnSync('npx', ['electron-builder', ...args, `--config.extraMetadata.version=${release}`], { + stdio: 'inherit', + shell: process.platform === 'win32', + env: { ...process.env, BUILD_NUMBER: process.env.BUILD_NUMBER ?? build } +}); +process.exit(result.status ?? 1);