Files
Void-Bastion/packaging/windows/build.ps1
T

45 lines
1.5 KiB
PowerShell

param(
[Parameter(Mandatory = $true)]
[string]$GodotExe,
[Parameter(Mandatory = $true)]
[string]$MakeNsisExe
)
$ErrorActionPreference = "Stop"
$projectRoot = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).Path
$gameExe = Join-Path $projectRoot "build\windows\Void-Bastion.exe"
$installer = Join-Path $projectRoot "dist\Void-Bastion-Setup-x64.exe"
$installerScript = Join-Path $PSScriptRoot "installer.nsi"
foreach ($requiredFile in @($GodotExe, $MakeNsisExe, $installerScript)) {
if (-not (Test-Path -LiteralPath $requiredFile -PathType Leaf)) {
throw "Benötigte Datei fehlt: $requiredFile"
}
}
New-Item -ItemType Directory -Force -Path (Split-Path $gameExe), (Split-Path $installer) | Out-Null
& $GodotExe --headless --path $projectRoot --export-release "Windows x64" $gameExe
if ($LASTEXITCODE -ne 0 -or -not (Test-Path -LiteralPath $gameExe)) {
throw "Der Godot-Windows-Export ist fehlgeschlagen."
}
Push-Location $PSScriptRoot
try {
& $MakeNsisExe $installerScript
if ($LASTEXITCODE -ne 0 -or -not (Test-Path -LiteralPath $installer)) {
throw "Die Installer-Erstellung mit NSIS ist fehlgeschlagen."
}
}
finally {
Pop-Location
}
$installerFile = Get-Item -LiteralPath $installer
$hash = Get-FileHash -Algorithm SHA256 -LiteralPath $installer
Write-Host "Windows-Installer erfolgreich erstellt:"
Write-Host " Datei: $($installerFile.FullName)"
Write-Host " Größe: $([math]::Round($installerFile.Length / 1MB, 1)) MiB"
Write-Host " SHA256: $($hash.Hash)"