update
This commit is contained in:
97
AzA march 2026 - Kopie (27)/build_release_manifest.ps1
Normal file
97
AzA march 2026 - Kopie (27)/build_release_manifest.ps1
Normal file
@@ -0,0 +1,97 @@
|
||||
$projectRoot = $PSScriptRoot
|
||||
$azaVersionPy = Join-Path $projectRoot "aza_version.py"
|
||||
$manifestPath = Join-Path $projectRoot "release\version.json"
|
||||
$releaseBaseUrl = $env:AZA_RELEASE_BASE_URL
|
||||
$installerPath = Join-Path $projectRoot "dist\installer\aza_desktop_setup.exe"
|
||||
|
||||
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 }
|
||||
$minRequired = if ($manifest.min_required_version) { $manifest.min_required_version } else { $minVersion }
|
||||
$downloadUrl = if ($releaseBaseUrl) {
|
||||
"$releaseBaseUrl/aza_desktop_setup.exe"
|
||||
} elseif ($manifest.download_url) {
|
||||
$manifest.download_url
|
||||
} else {
|
||||
"https://api.aza-medwork.ch/downloads/aza_desktop_setup.exe"
|
||||
}
|
||||
$installerType = if ($manifest.installer_type) { $manifest.installer_type } else { "inno-setup" }
|
||||
$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()
|
||||
}
|
||||
|
||||
$newManifest = [ordered]@{
|
||||
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
|
||||
}
|
||||
|
||||
$newManifest | ConvertTo-Json -Depth 6 | Set-Content $manifestPath -Encoding UTF8
|
||||
|
||||
if (-not $appVersion) {
|
||||
Write-Error "release/version.json konnte nicht erzeugt werden."
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "release/version.json aktualisiert."
|
||||
Write-Host "Version: $appVersion Build: $buildStamp"
|
||||
if ($sha256Hex) {
|
||||
Write-Host "SHA256: $sha256Hex"
|
||||
}
|
||||
if ($releaseBaseUrl) {
|
||||
Write-Host "Download-URL Base: $releaseBaseUrl"
|
||||
}
|
||||
Reference in New Issue
Block a user