Some checks failed
farmcontrol/farmcontrol-server/pipeline/head There was a failure building this commit
- Introduced a new Windows Installer XML (WXS) file for packaging the Farm Control Server as an MSI. - Added a PowerShell script to build the MSI from the WXS file. - Implemented a new script to finalize desktop artifacts, handling the publication of macOS and Windows packages. - Updated the Linux build script to improve artifact naming and organization. - Enhanced the Electrobun configuration to include a post-package script for finalizing desktop artifacts.
67 lines
1.5 KiB
PowerShell
67 lines
1.5 KiB
PowerShell
param(
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$SetupExe,
|
|
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$OutputMsi,
|
|
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$Version
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
function Find-WixTool($toolName) {
|
|
$command = Get-Command $toolName -ErrorAction SilentlyContinue
|
|
if ($command) {
|
|
return $command.Source
|
|
}
|
|
|
|
$searchRoots = @(
|
|
"${env:ProgramFiles(x86)}\WiX Toolset v3.14\bin",
|
|
"${env:ProgramFiles(x86)}\WiX Toolset v3.11\bin",
|
|
"${env:ProgramFiles}\WiX Toolset v3.14\bin",
|
|
"${env:ProgramFiles}\WiX Toolset v3.11\bin"
|
|
)
|
|
|
|
foreach ($root in $searchRoots) {
|
|
$candidate = Join-Path $root "$toolName.exe"
|
|
if (Test-Path $candidate) {
|
|
return $candidate
|
|
}
|
|
}
|
|
|
|
throw "Could not find $toolName. Install WiX Toolset v3.11 or v3.14 on the Windows build agent."
|
|
}
|
|
|
|
$rootDir = Split-Path -Parent $PSScriptRoot
|
|
$wxsPath = Join-Path $rootDir "packaging/windows/farmcontrol-server.wxs"
|
|
$workDir = Join-Path $env:TEMP "farmcontrol-server-msi"
|
|
$wixObj = Join-Path $workDir "farmcontrol-server.wixobj"
|
|
|
|
if (Test-Path $workDir) {
|
|
Remove-Item $workDir -Recurse -Force
|
|
}
|
|
New-Item -ItemType Directory -Path $workDir | Out-Null
|
|
|
|
$candle = Find-WixTool "candle"
|
|
$light = Find-WixTool "light"
|
|
|
|
& $candle `
|
|
-nologo `
|
|
-out $wixObj `
|
|
-dVersion=$Version `
|
|
-dSetupExe=$SetupExe `
|
|
$wxsPath
|
|
|
|
& $light `
|
|
-nologo `
|
|
-out $OutputMsi `
|
|
$wixObj
|
|
|
|
if (-not (Test-Path $OutputMsi)) {
|
|
throw "MSI was not created at $OutputMsi"
|
|
}
|
|
|
|
Write-Host "Created MSI at $OutputMsi"
|