Update Windows installer scripts to include build number and branding text

- Modified `farmcontrol.nsi` to define a default build number and updated branding text to reflect versioning.
- Enhanced `build-windows-nsis.ps1` to accept a build number parameter, defaulting to "dev".
- Updated `finalize-desktop-artifacts.mjs` to retrieve the build number from various sources, ensuring accurate versioning in the installer.
This commit is contained in:
Tom Butcher 2026-08-02 21:53:38 +01:00
parent 282d0c6630
commit 35a50fa97d
3 changed files with 21 additions and 2 deletions

View File

@ -1,4 +1,4 @@
!include "MUI2.nsh"
!include "MUI2.nsh"
!include "LogicLib.nsh"
!include "installer.nsh"
@ -10,6 +10,10 @@
!define VERSION "0.1.0"
!endif
!ifndef BUILD_NUMBER
!define BUILD_NUMBER "dev"
!endif
!ifndef APP_SOURCE_DIR
!define APP_SOURCE_DIR "app"
!endif
@ -21,6 +25,7 @@ InstallDirRegKey HKLM "Software\Tom Butcher\Farm Control" "InstallDir"
RequestExecutionLevel admin
!define MUI_ABORTWARNING
!define MUI_BRANDINGTEXT "Farm Control v${VERSION}-b${BUILD_NUMBER} Installer"
!ifndef INSTALLER_ICON
!define INSTALLER_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"

View File

@ -8,6 +8,8 @@ param(
[Parameter(Mandatory = $true)]
[string]$Version,
[string]$BuildNumber = "dev",
[long]$MinInstallerBytes = 10485760
)
@ -97,6 +99,7 @@ $makensisArgs = @(
"/NOCD"
"/DOUTFILE=$localInstallerName"
"/DVERSION=$Version"
"/DBUILD_NUMBER=$BuildNumber"
"/DAPP_SOURCE_DIR=app"
)

View File

@ -447,6 +447,15 @@ function buildWindowsNsis(appDir, arch) {
artifactDir,
getReleaseArtifactName(version, arch, 'exe')
)
const buildInfoPath = path.join(rootDir, 'src/buildInfo.json')
const buildInfo = existsSync(buildInfoPath)
? JSON.parse(readFileSync(buildInfoPath, 'utf8'))
: {}
const buildNumber =
process.env.BUILD_NUMBER ||
process.env.VITE_BUILD_NUMBER ||
buildInfo.buildNumber ||
'dev'
const powershell = process.env.SystemRoot
? path.join(
process.env.SystemRoot,
@ -470,7 +479,9 @@ function buildWindowsNsis(appDir, arch) {
'-OutputExe',
exePath,
'-Version',
version
version,
'-BuildNumber',
buildNumber
],
{ stdio: 'inherit' }
)