2026-03-25 22:03:39 +01:00
|
|
|
$projectRoot = $PSScriptRoot
|
|
|
|
|
$azaVersionPy = Join-Path $projectRoot "aza_version.py"
|
|
|
|
|
$manifestPath = Join-Path $projectRoot "release\version.json"
|
|
|
|
|
$releaseBaseUrl = $env:AZA_RELEASE_BASE_URL
|
2026-05-16 20:33:36 +02:00
|
|
|
$installerPath = Join-Path $projectRoot "dist\installer\aza_desktop_setup.exe"
|
2026-03-25 22:03:39 +01:00
|
|
|
|
|
|
|
|
if (-not (Test-Path $azaVersionPy)) {
|
|
|
|
|
Write-Error "aza_version.py nicht gefunden: $azaVersionPy"
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Write-Host "Erzeuge release/version.json aus aza_version.py..."
|
|
|
|
|
|
|
|
|
|
$versionContent = Get-Content $azaVersionPy -Raw
|
|
|
|
|
if ($versionContent -match 'APP_VERSION\s*=\s*"([^"]+)"') {
|
|
|
|
|
$appVersion = $matches[1].Trim()
|
|
|
|
|
} else {
|
|
|
|
|
Write-Error "APP_VERSION nicht in aza_version.py gefunden."
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
if ($versionContent -match 'APP_CHANNEL\s*=\s*"([^"]+)"') {
|
|
|
|
|
$appChannel = $matches[1].Trim()
|
|
|
|
|
} else {
|
|
|
|
|
Write-Error "APP_CHANNEL nicht in aza_version.py gefunden."
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$manifest = @{}
|
|
|
|
|
if (Test-Path $manifestPath) {
|
|
|
|
|
$manifest = Get-Content $manifestPath -Raw | ConvertFrom-Json
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$releaseDate = if ($manifest.release_date) { $manifest.release_date } else { (Get-Date).ToString("yyyy-MM-dd") }
|
|
|
|
|
$minVersion = if ($manifest.minimum_supported_version) { $manifest.minimum_supported_version } else { $appVersion }
|
2026-05-16 20:33:36 +02:00
|
|
|
$minRequired = if ($manifest.min_required_version) { $manifest.min_required_version } else { $minVersion }
|
2026-03-25 22:03:39 +01:00
|
|
|
$downloadUrl = if ($releaseBaseUrl) {
|
|
|
|
|
"$releaseBaseUrl/aza_desktop_setup.exe"
|
|
|
|
|
} elseif ($manifest.download_url) {
|
|
|
|
|
$manifest.download_url
|
|
|
|
|
} else {
|
2026-05-16 20:33:36 +02:00
|
|
|
"https://api.aza-medwork.ch/downloads/aza_desktop_setup.exe"
|
2026-03-25 22:03:39 +01:00
|
|
|
}
|
|
|
|
|
$installerType = if ($manifest.installer_type) { $manifest.installer_type } else { "inno-setup" }
|
2026-05-16 20:33:36 +02:00
|
|
|
$notesExisting = @()
|
|
|
|
|
if ($manifest.notes -and $manifest.notes.Length -gt 0) {
|
|
|
|
|
$notesExisting = @($manifest.notes)
|
|
|
|
|
} elseif ($manifest.release_notes -and $manifest.release_notes.Length -gt 0) {
|
|
|
|
|
$notesExisting = @($manifest.release_notes)
|
|
|
|
|
}
|
|
|
|
|
$notesList = if ($notesExisting.Count -gt 0) { $notesExisting } else { @("Desktop-Build aktualisiert") }
|
|
|
|
|
$updateLevel = if ($manifest.update_level) { $manifest.update_level.ToString().ToLowerInvariant() } else { "recommended" }
|
|
|
|
|
if ($updateLevel -ne "optional" -and $updateLevel -ne "recommended" -and $updateLevel -ne "required") {
|
|
|
|
|
$updateLevel = "recommended"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$buildStamp = (Get-Date).ToString("yyyyMMdd_HHmmss")
|
|
|
|
|
$sha256Hex = $null
|
|
|
|
|
if (Test-Path $installerPath) {
|
|
|
|
|
$buildStamp = (Get-Item $installerPath).LastWriteTime.ToString("yyyyMMdd_HHmmss")
|
|
|
|
|
$sha256Hex = (Get-FileHash -Path $installerPath -Algorithm SHA256).Hash
|
|
|
|
|
} elseif ($manifest.build) {
|
|
|
|
|
$buildStamp = $manifest.build.ToString()
|
|
|
|
|
}
|
|
|
|
|
if (-not $sha256Hex -and $manifest.sha256) {
|
|
|
|
|
$sha256Hex = $manifest.sha256.ToString()
|
|
|
|
|
}
|
2026-03-25 22:03:39 +01:00
|
|
|
|
|
|
|
|
$newManifest = [ordered]@{
|
2026-05-16 20:33:36 +02:00
|
|
|
version = $appVersion
|
|
|
|
|
build = $buildStamp
|
|
|
|
|
channel = $appChannel
|
|
|
|
|
release_date = $releaseDate
|
|
|
|
|
minimum_supported_version = $minVersion
|
|
|
|
|
min_required_version = $minRequired
|
|
|
|
|
download_url = $downloadUrl
|
|
|
|
|
sha256 = $sha256Hex
|
|
|
|
|
update_level = $updateLevel
|
|
|
|
|
installer_type = $installerType
|
|
|
|
|
notes = $notesList
|
|
|
|
|
release_notes = $notesList
|
2026-03-25 22:03:39 +01:00
|
|
|
}
|
|
|
|
|
|
2026-05-16 20:33:36 +02:00
|
|
|
$newManifest | ConvertTo-Json -Depth 6 | Set-Content $manifestPath -Encoding UTF8
|
2026-03-25 22:03:39 +01:00
|
|
|
|
|
|
|
|
if (-not $appVersion) {
|
|
|
|
|
Write-Error "release/version.json konnte nicht erzeugt werden."
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Write-Host "release/version.json aktualisiert."
|
2026-05-16 20:33:36 +02:00
|
|
|
Write-Host "Version: $appVersion Build: $buildStamp"
|
|
|
|
|
if ($sha256Hex) {
|
|
|
|
|
Write-Host "SHA256: $sha256Hex"
|
|
|
|
|
}
|
2026-03-25 22:03:39 +01:00
|
|
|
if ($releaseBaseUrl) {
|
|
|
|
|
Write-Host "Download-URL Base: $releaseBaseUrl"
|
|
|
|
|
}
|