feat(update): add transactional external updater

This commit is contained in:
chengma
2026-07-13 12:07:59 +08:00
parent 3ad9ffd239
commit bab2609a85
9 changed files with 578 additions and 2 deletions
+13
View File
@@ -120,6 +120,18 @@ if ($LASTEXITCODE -ne 0) {
throw "$(Decode-Utf8Base64 "UHlJbnN0YWxsZXIg5omT5YyF5aSx6LSl77yM6YCA5Ye656CB"): $LASTEXITCODE"
}
$updaterSpec = Join-Path $repoRoot "cmshopee-updater.spec"
$updaterDist = Join-Path $repoRoot "dist\updater"
$updaterWork = Join-Path $repoRoot "build\updater"
& $pythonExe @pythonArgs -m PyInstaller --noconfirm --clean --distpath $updaterDist --workpath $updaterWork $updaterSpec
if ($LASTEXITCODE -ne 0) {
throw "独立更新器打包失败,退出码: $LASTEXITCODE"
}
$updaterExe = Join-Path $updaterDist "cmshopee-updater.exe"
if (-not (Test-Path -LiteralPath $updaterExe)) {
throw "独立更新器产物不存在: $updaterExe"
}
$distDir = Join-Path $repoRoot "dist\cmshopee"
$exePath = Join-Path $distDir "cmshopee.exe"
if (-not (Test-Path -LiteralPath $exePath)) {
@@ -164,6 +176,7 @@ foreach ($path in @($releaseDir, $portableZip, $releaseMetadata)) {
New-Item -ItemType Directory -Force -Path $releaseDir | Out-Null
Get-ChildItem -LiteralPath $distDir -Force | Copy-Item -Destination $releaseDir -Recurse -Force
Copy-Item -LiteralPath $updaterExe -Destination (Join-Path $releaseDir "cmshopee-updater.exe") -Force
Set-Content -LiteralPath (Join-Path $releaseDir "version.txt") -Value $appVersion -Encoding ascii -NoNewline
$readme = @(