Files
aza/AzA march 2026 - Kopie (18)/build_release_artifacts.ps1
2026-04-22 22:33:46 +02:00

82 lines
2.9 KiB
PowerShell

$projectRoot = $PSScriptRoot
$desktopExe = Join-Path $projectRoot "dist\aza_desktop\aza_desktop.exe"
$installerExe = Join-Path $projectRoot "dist\installer\aza_desktop_setup.exe"
$manifestPath = Join-Path $projectRoot "release\version.json"
$reportDir = Join-Path $projectRoot "dist\release_artifacts"
$reportPath = Join-Path $reportDir "release_artifacts.json"
if (-not (Test-Path $desktopExe)) {
Write-Error "Desktop-EXE nicht gefunden: $desktopExe"
exit 1
}
if (-not (Test-Path $installerExe)) {
Write-Error "Installer nicht gefunden: $installerExe"
exit 1
}
if (-not (Test-Path $manifestPath)) {
Write-Error "Release-Manifest nicht gefunden: $manifestPath"
exit 1
}
if (-not (Test-Path $reportDir)) {
New-Item -ItemType Directory -Path $reportDir | Out-Null
}
$manifest = Get-Content $manifestPath -Raw | ConvertFrom-Json
$desktopHash = (Get-FileHash $desktopExe -Algorithm SHA256).Hash
$installerHash = (Get-FileHash $installerExe -Algorithm SHA256).Hash
$desktopItem = Get-Item $desktopExe
$installerItem = Get-Item $installerExe
$desktopSig = Get-AuthenticodeSignature -FilePath $desktopExe -ErrorAction SilentlyContinue
$installerSig = Get-AuthenticodeSignature -FilePath $installerExe -ErrorAction SilentlyContinue
$desktopSignStatus = if ($desktopSig -and $desktopSig.Status -eq "Valid") { "signed" } else { "unsigned" }
$installerSignStatus = if ($installerSig -and $installerSig.Status -eq "Valid") { "signed" } else { "unsigned" }
$desktopSignSubject = if ($desktopSig -and $desktopSig.SignerCertificate) { $desktopSig.SignerCertificate.Subject } else { $null }
$installerSignSubject = if ($installerSig -and $installerSig.SignerCertificate) { $installerSig.SignerCertificate.Subject } else { $null }
$report = [ordered]@{
generated_at = (Get-Date).ToString("yyyy-MM-ddTHH:mm:ss")
version = $manifest.version
channel = $manifest.channel
release_date = $manifest.release_date
files = @(
[ordered]@{
type = "desktop_exe"
path = $desktopExe
filename = $desktopItem.Name
size_bytes = $desktopItem.Length
sha256 = $desktopHash
signing_status = $desktopSignStatus
signing_subject = $desktopSignSubject
},
[ordered]@{
type = "installer"
path = $installerExe
filename = $installerItem.Name
size_bytes = $installerItem.Length
sha256 = $installerHash
signing_status = $installerSignStatus
signing_subject = $installerSignSubject
}
)
}
$report | ConvertTo-Json -Depth 5 | Set-Content $reportPath -Encoding UTF8
Write-Host "Release-Artefakt-Report erstellt:"
Write-Host $reportPath
Write-Host ""
Write-Host "Desktop EXE SHA256:"
Write-Host $desktopHash
Write-Host "Desktop EXE Signatur: $desktopSignStatus"
Write-Host ""
Write-Host "Installer SHA256:"
Write-Host $installerHash
Write-Host "Installer Signatur: $installerSignStatus"