fix(installer): derive installer version from the git tag, not a hardcoded default
installer.iss had #define MyAppVersion "2.1.0", so every release's setup.exe (and its AppVersion/VersionInfoVersion) self-identified as 2.1.0 regardless of the actual tag. setup-build-env.ps1 now passes /DMyAppVersion derived from GITHUB_REF_NAME (CI tag run) or git describe, falling back to a 0.0.0-dev placeholder in the .iss only for bare manual compiles.
This commit is contained in:
@@ -5,10 +5,14 @@
|
|||||||
; runtime. Nothing on the target machine requires internet access.
|
; runtime. Nothing on the target machine requires internet access.
|
||||||
;
|
;
|
||||||
; Usage:
|
; Usage:
|
||||||
; iscc installer\windows\installer.iss
|
; iscc "/DMyAppVersion=2.2.0" installer\windows\installer.iss
|
||||||
; theta-agent-2.1.0-windows-amd64-setup.exe /SILENT ^
|
; theta-agent-2.2.0-windows-amd64-setup.exe /SILENT ^
|
||||||
; /SERVER_URL=https://sso.example.com /JOIN_KEY=tjk_...
|
; /SERVER_URL=https://sso.example.com /JOIN_KEY=tjk_...
|
||||||
;
|
;
|
||||||
|
; The version is passed in by scripts/setup-build-env.ps1 (derived from the
|
||||||
|
; git tag). The default below exists only so a bare `iscc installer.iss` call
|
||||||
|
; still compiles; it should never be the version in a real build.
|
||||||
|
;
|
||||||
; Interactively, a wizard page asks for the Theta Directory URL and a join key
|
; Interactively, a wizard page asks for the Theta Directory URL and a join key
|
||||||
; (with a button that opens the Theta Directory's Directory -> Install Agent page
|
; (with a button that opens the Theta Directory's Directory -> Install Agent page
|
||||||
; to mint one). In silent mode, /SERVER_URL, /JOIN_KEY, /AUTH_TOKEN, /PUBLIC_KEY
|
; to mint one). In silent mode, /SERVER_URL, /JOIN_KEY, /AUTH_TOKEN, /PUBLIC_KEY
|
||||||
@@ -16,7 +20,7 @@
|
|||||||
; are written into agent.yml so the installed service enrolls on first start.
|
; are written into agent.yml so the installed service enrolls on first start.
|
||||||
|
|
||||||
#ifndef MyAppVersion
|
#ifndef MyAppVersion
|
||||||
#define MyAppVersion "2.1.0"
|
#define MyAppVersion "0.0.0-dev"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MyAppName "Theta Agent"
|
#define MyAppName "Theta Agent"
|
||||||
|
|||||||
@@ -273,8 +273,21 @@ function Invoke-Build {
|
|||||||
|
|
||||||
$iscc = Find-Iscc
|
$iscc = Find-Iscc
|
||||||
if (-not $iscc) { Write-Fail 'ISCC not found; cannot build installer'; return }
|
if (-not $iscc) { Write-Fail 'ISCC not found; cannot build installer'; return }
|
||||||
Write-Step "Compiling installer with ISCC"
|
|
||||||
& $iscc (Join-Path $RepoRoot 'installer\windows\installer.iss')
|
# The installer must not carry a stale hardcoded version: derive it from
|
||||||
|
# the tag on CI (GITHUB_REF_NAME, e.g. "v2.2.0"), else the nearest local
|
||||||
|
# tag, else a plain dev marker. Passed as -DMyAppVersion so
|
||||||
|
# installer.iss's #ifndef default is always overridden by the build.
|
||||||
|
$appVer = '0.0.0-dev'
|
||||||
|
if ($env:GITHUB_REF_NAME -match 'v?([0-9]+\.[0-9]+\.[0-9]+)') {
|
||||||
|
$appVer = $matches[1]
|
||||||
|
} else {
|
||||||
|
$desc = git describe --tags --abbrev=0 2>$null
|
||||||
|
if ($desc -match 'v?([0-9]+\.[0-9]+\.[0-9]+)') { $appVer = $matches[1] }
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Step "Compiling installer with ISCC (version $appVer)"
|
||||||
|
& $iscc "/DMyAppVersion=$appVer" (Join-Path $RepoRoot 'installer\windows\installer.iss')
|
||||||
if ($LASTEXITCODE -ne 0) { Write-Fail 'ISCC compile failed' }
|
if ($LASTEXITCODE -ne 0) { Write-Fail 'ISCC compile failed' }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user