ci: alle app-builder-GitHub-Downloads resumefaehig vorladen
winCodeSign starb an denselben CDN-Resets wie zuvor die Electron-Binary (Job 424); Prefetch-Skript konsolidiert Electron-Zip + winCodeSign + NSIS-Pakete mit curl -C - in die persistenten Caches (ELECTRON_CACHE, ELECTRON_BUILDER_CACHE). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKhFj1S3UdD6xL2fbWPeYj
This commit is contained in:
co-authored by
Claude Fable 5
parent
cf66ff018d
commit
a55adfdd65
@@ -0,0 +1,48 @@
|
||||
# Laedt die Build-Artefakte resumefaehig vor, die app-builder sonst selbst (ohne
|
||||
# Resume) von GitHub laedt: das CDN (185.199.109.x) reisst im Lab-Gast groessere
|
||||
# Transfers reproduzierbar mitten im Stream ab (Jobs 415/416/424, wsarecv-Reset).
|
||||
# curl -C - setzt nach jedem Abriss am letzten Byte fort; einmal geladen liegen
|
||||
# die Artefakte in den persistenten Caches (ELECTRON_CACHE/ELECTRON_BUILDER_CACHE)
|
||||
# und werden nie erneut geholt.
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
function Get-Resumable([string]$Url, [string]$Out) {
|
||||
foreach ($i in 1..8) {
|
||||
& curl.exe -sSL -C - -o $Out $Url
|
||||
if ($LASTEXITCODE -eq 0) { return }
|
||||
Start-Sleep 5
|
||||
}
|
||||
throw "Download nach 8 Versuchen gescheitert: $Url"
|
||||
}
|
||||
|
||||
# --- 1. Electron-Binary -> ELECTRON_CACHE ------------------------------------
|
||||
$pkg = Join-Path $PSScriptRoot '..\package.json'
|
||||
$ev = (& node -p "require(process.argv[1]).devDependencies.electron" $pkg) -replace '[\^~]', ''
|
||||
New-Item -ItemType Directory -Force $env:ELECTRON_CACHE | Out-Null
|
||||
$zip = Join-Path $env:ELECTRON_CACHE "electron-v$ev-win32-x64.zip"
|
||||
if (-not (Test-Path $zip)) {
|
||||
Get-Resumable "https://github.com/electron/electron/releases/download/v$ev/electron-v$ev-win32-x64.zip" "$zip.part"
|
||||
Move-Item -Force "$zip.part" $zip
|
||||
}
|
||||
|
||||
# --- 2. electron-builder-Werkzeuge -> ELECTRON_BUILDER_CACHE -----------------
|
||||
# Zielstruktur wie app-builder sie erwartet: <Cache>\<SubDir>\<Name>-<Version>\
|
||||
$sevenZa = Join-Path $PSScriptRoot '..\..\..\node_modules\7zip-bin\win\x64\7za.exe'
|
||||
function Get-EbArtifact([string]$Name, [string]$Version, [string]$SubDir) {
|
||||
$dest = Join-Path $env:ELECTRON_BUILDER_CACHE (Join-Path $SubDir "$Name-$Version")
|
||||
if (Test-Path $dest) { return }
|
||||
$tmp = Join-Path $env:TEMP "$Name-$Version.7z"
|
||||
Get-Resumable "https://github.com/electron-userland/electron-builder-binaries/releases/download/$Name-$Version/$Name-$Version.7z" $tmp
|
||||
New-Item -ItemType Directory -Force $dest | Out-Null
|
||||
& $sevenZa x -y "-o$dest" $tmp | Out-Null
|
||||
if ($LASTEXITCODE -ne 0) { Remove-Item -Recurse -Force $dest; throw "Entpacken gescheitert: $tmp" }
|
||||
}
|
||||
|
||||
# Versionen passend zu electron-builder 26.9.1 (winCodeSign aus dem Job-424-Trace;
|
||||
# die nsis-Versionen sind seit Jahren stabil). Bei einem kuenftigen Mismatch laedt
|
||||
# app-builder die richtige Version selbst und der Fehler nennt sie im Trace.
|
||||
Get-EbArtifact 'winCodeSign' '2.6.0' 'winCodeSign'
|
||||
Get-EbArtifact 'nsis' '3.0.4.1' 'nsis'
|
||||
Get-EbArtifact 'nsis-resources' '3.4.1' 'nsis'
|
||||
|
||||
Write-Output "prefetch ok: electron v$ev + winCodeSign/nsis in den Caches"
|
||||
Reference in New Issue
Block a user