ci: fix broken windows tool
Queue Release Build / prepare (push) Successful in 1m54s
Queue Release Build / build-windows (push) Successful in 30m48s
Queue Release Build / build-linux (push) Successful in 44m39s
Queue Release Build / build-android (push) Successful in 20m7s
Queue Release Build / finalize (push) Successful in 1m0s
Deploy Web Apps / deploy (push) Successful in 6m28s

This commit is contained in:
2026-08-14 11:25:56 +02:00
parent 1ce72e7ac3
commit 9429dacac5
2 changed files with 61 additions and 4 deletions
+51 -4
View File
@@ -249,8 +249,8 @@ jobs:
run: |
$projectRoot = $PWD.ProviderPath
$electronBuilderWorkspace = Join-Path $env:TEMP ([guid]::NewGuid().ToString('N'))
$electronBuilderCache = Join-Path $electronBuilderWorkspace 'electron-builder-cache'
$electronCache = Join-Path $electronBuilderWorkspace 'electron-cache'
$electronBuilderCache = Join-Path $env:LOCALAPPDATA 'electron-builder\Cache'
$electronCache = Join-Path $env:LOCALAPPDATA 'electron\Cache'
$locationPushed = $false
function Invoke-RoboCopy {
@@ -266,21 +266,68 @@ jobs:
}
}
function Initialize-WinCodeSignCache {
param(
[string]$CacheRoot,
[string]$SevenZip
)
# electron-builder downloads winCodeSign for rcedit (icon and version stamping)
# even when nothing is signed. Its two darwin symlinks cannot be recreated
# without SeCreateSymbolicLinkPrivilege, so seed the cache without them.
# The version must match the one app-builder resolves, otherwise it downloads
# its own copy and fails on the symlinks again.
$version = 'winCodeSign-2.6.0'
$target = Join-Path $CacheRoot "winCodeSign\$version"
if (Test-Path $target) {
return
}
$staging = "$target.incomplete"
$archive = Join-Path $env:TEMP "$version.7z"
$url = "https://github.com/electron-userland/electron-builder-binaries/releases/download/$version/$version.7z"
Remove-Item $staging -Recurse -Force -ErrorAction SilentlyContinue
try {
$ProgressPreference = 'SilentlyContinue'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri $url -OutFile $archive -UseBasicParsing
& $SevenZip x -bd -y "-o$staging" '-x!darwin' $archive | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "failed to extract $version with exit code $LASTEXITCODE"
}
New-Item -ItemType Directory -Path (Split-Path -Parent $target) -Force | Out-Null
Move-Item $staging $target
} finally {
Remove-Item $archive -Force -ErrorAction SilentlyContinue
Remove-Item $staging -Recurse -Force -ErrorAction SilentlyContinue
}
}
# Stage the packaging inputs into a real short-path directory.
# electron-builder rejects junction-backed files during asar creation
# because their resolved path sits outside the package root.
New-Item -ItemType Directory -Path $electronBuilderWorkspace | Out-Null
New-Item -ItemType Directory -Path $electronBuilderCache | Out-Null
New-Item -ItemType Directory -Path $electronCache | Out-Null
New-Item -ItemType Directory -Path $electronBuilderCache -Force | Out-Null
New-Item -ItemType Directory -Path $electronCache -Force | Out-Null
$env:ELECTRON_BUILDER_CACHE = $electronBuilderCache
$env:ELECTRON_CACHE = $electronCache
try {
Initialize-WinCodeSignCache `
-CacheRoot $electronBuilderCache `
-SevenZip (Join-Path $projectRoot 'node_modules\7zip-bin\win\x64\7za.exe')
Copy-Item -Path (Join-Path $projectRoot 'package.json') -Destination (Join-Path $electronBuilderWorkspace 'package.json') -Force
Copy-Item -Path (Join-Path $projectRoot 'package-lock.json') -Destination (Join-Path $electronBuilderWorkspace 'package-lock.json') -Force
Invoke-RoboCopy (Join-Path $projectRoot 'dist') (Join-Path $electronBuilderWorkspace 'dist')
Invoke-RoboCopy (Join-Path $projectRoot 'docs-site/build') (Join-Path $electronBuilderWorkspace 'docs-site/build')
Invoke-RoboCopy (Join-Path $projectRoot 'images') (Join-Path $electronBuilderWorkspace 'images')
Invoke-RoboCopy (Join-Path $projectRoot 'tools') (Join-Path $electronBuilderWorkspace 'tools')
Invoke-RoboCopy (Join-Path $projectRoot 'node_modules') (Join-Path $electronBuilderWorkspace 'node_modules')
Push-Location $electronBuilderWorkspace