fix(desktop): stamp the release version into desktop builds (#206)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f8bfee18d9
commit
b33b3f43ac
2 files changed
+36
-1
No files matched your search
@@ -11,7 +11,13 @@
|
|||||||
name: Desktop packages
|
name: Desktop packages
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call: {}
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
tag:
|
||||||
|
description: Release tag (vX.Y.Z) stamped into the app; empty keeps dev versions.
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: ""
|
||||||
workflow_dispatch: {}
|
workflow_dispatch: {}
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@@ -46,6 +52,33 @@ jobs:
|
|||||||
node-version: 24
|
node-version: 24
|
||||||
cache: pnpm
|
cache: pnpm
|
||||||
|
|
||||||
|
# Stamp the release version the same way release.yml stamps the CLI artifacts —
|
||||||
|
# core's VERSION/BUILD_DATE constants (what the app and server report) plus the
|
||||||
|
# desktop package.json electron-builder reads its installer metadata from;
|
||||||
|
# otherwise every installer carries the in-repo dev version (v0.2.1 shipped
|
||||||
|
# Windows metadata saying 0.2.0 this way). node instead of sed -i: this matrix
|
||||||
|
# includes macOS, whose BSD sed spells in-place editing differently. Dry runs
|
||||||
|
# (no tag) keep the dev versions.
|
||||||
|
- name: Stamp release version
|
||||||
|
if: inputs.tag != ''
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
TAG: ${{ inputs.tag }}
|
||||||
|
run: |
|
||||||
|
V="${TAG#v}"
|
||||||
|
D="$(date -u +%Y-%m-%d)"
|
||||||
|
V="$V" D="$D" node -e '
|
||||||
|
const fs = require("fs");
|
||||||
|
const p = "packages/core/src/index.ts";
|
||||||
|
let s = fs.readFileSync(p, "utf8");
|
||||||
|
if (!/export const VERSION = "/.test(s)) throw new Error("VERSION const not found");
|
||||||
|
s = s.replace(/export const VERSION = "[^"]*"/, `export const VERSION = "${process.env.V}"`);
|
||||||
|
if (!/export const BUILD_DATE: string \| null = /.test(s)) throw new Error("BUILD_DATE const not found");
|
||||||
|
s = s.replace(/export const BUILD_DATE: string \| null = [^;]*/, `export const BUILD_DATE: string | null = "${process.env.D}"`);
|
||||||
|
fs.writeFileSync(p, s);
|
||||||
|
'
|
||||||
|
(cd packages/desktop && npm version --no-git-tag-version --allow-same-version "$V")
|
||||||
|
|
||||||
- run: pnpm install --frozen-lockfile
|
- run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- run: pnpm -r build
|
- run: pnpm -r build
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ jobs:
|
|||||||
needs: check-release
|
needs: check-release
|
||||||
if: needs.check-release.outputs.exists != 'true'
|
if: needs.check-release.outputs.exists != 'true'
|
||||||
uses: ./.github/workflows/desktop-build.yml
|
uses: ./.github/workflows/desktop-build.yml
|
||||||
|
with:
|
||||||
|
tag: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
|
||||||
|
|
||||||
release:
|
release:
|
||||||
needs: [check-release, desktop]
|
needs: [check-release, desktop]
|
||||||
|
|||||||
Reference in new issue
Block a user