Files
QSfera/Desktop/scripts/validate-production-release.ps1
T
Курнат Андрей 43caef7a6a Prepare QSfera production release
2026-06-08 19:57:40 +03:00

61 lines
2.0 KiB
PowerShell

param(
[switch]$RequireSigning,
[string]$Root = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
)
$ErrorActionPreference = "Stop"
function Fail($Message) {
Write-Error $Message
exit 1
}
function Read-Text($RelativePath) {
Get-Content -LiteralPath (Join-Path $Root $RelativePath) -Raw -Encoding UTF8
}
$branding = Read-Text "QSFERA.cmake"
$cmake = Read-Text "CMakeLists.txt"
$craft = Read-Text ".craft.ini"
$expectedAppName = -join ([char[]](0x041a, 0x0443, 0x0421, 0x0444, 0x0435, 0x0440, 0x0430))
if (-not $branding.Contains("APPLICATION_NAME") -or -not $branding.Contains($expectedAppName)) {
Fail "Desktop branding must use the production Cyrillic application name."
}
if ($branding -notmatch 'APPLICATION_EXECUTABLE\s+"qsfera"') {
Fail "Desktop executable must remain `"qsfera`" for the production profile."
}
if ($branding -notmatch 'APPLICATION_REV_DOMAIN\s+"eu\.qsfera\.desktop"') {
Fail "Desktop reverse-domain id must remain eu.qsfera.desktop for the production profile."
}
if ($branding -notmatch 'APPLICATION_DEFAULT_SERVER_URL\s+"https://qsfera\.kusoft\.xyz"') {
Fail "Desktop default server URL must be https://qsfera.kusoft.xyz."
}
if ($cmake -notmatch 'option\(WITH_UPDATE_NOTIFICATION\s+"Whether to check for new releases"\s+ON\)') {
Fail "Desktop release builds must keep update notifications enabled by default."
}
if ($cmake -notmatch 'VIRTUAL_FILE_SYSTEM_PLUGINS\s+off\s+cfapi\s+openvfs') {
Fail "Desktop release builds must include the Windows CfAPI VFS plugin."
}
if ($craft -notmatch 'CodeSigning/Enabled\s*=\s*\$\{Env:SIGN_PACKAGE\}') {
Fail "Craft code-signing must be controlled by SIGN_PACKAGE."
}
if ($RequireSigning) {
if ($env:SIGN_PACKAGE -notin @("True", "true", "1", "yes", "YES")) {
Fail "Production Windows tag releases require SIGN_PACKAGE=True."
}
if ([string]::IsNullOrWhiteSpace($env:CRAFT_CODESIGN_CERTIFICATE)) {
Fail "Production Windows tag releases require CRAFT_CODESIGN_CERTIFICATE."
}
}
Write-Host "QSfera Desktop production release validation passed."