Skip to content

Commit 30137e9

Browse files
committed
fix(release): avoid PowerShell crashes on Windows ARM
1 parent d83929a commit 30137e9

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

‎.github/workflows/release-desktop.yml‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,29 @@ jobs:
129129
git sparse-checkout set --no-cone '/*' '!/.repos/'
130130
git -c checkout.workers=0 checkout --detach FETCH_HEAD
131131
132+
# The runner's PowerShell 7.6/.NET 10 intermittently crashes during signing:
133+
# https://github.com/dotnet/runtime/issues/131636
134+
# Put the .NET 8 release first for both workflow shells and electron-builder.
135+
- name: Use PowerShell 7.4 for Windows ARM builds
136+
if: inputs.platform == 'win' && inputs.arch == 'arm64'
137+
shell: powershell
138+
run: |
139+
$ErrorActionPreference = "Stop"
140+
$version = "7.4.20"
141+
$archive = Join-Path $env:RUNNER_TEMP "PowerShell-$version-win-arm64.zip"
142+
$installDir = Join-Path $env:RUNNER_TEMP "powershell-$version-arm64"
143+
Invoke-WebRequest -UseBasicParsing `
144+
-Uri "https://github.com/PowerShell/PowerShell/releases/download/v$version/PowerShell-$version-win-arm64.zip" `
145+
-OutFile $archive
146+
$expectedHash = "67eff749d5dae357501c95a3eec1dcd93f669824e3ca2b1d2adcdecdebf04f35"
147+
if ((Get-FileHash $archive -Algorithm SHA256).Hash -ne $expectedHash) {
148+
throw "PowerShell archive checksum mismatch"
149+
}
150+
Expand-Archive -Path $archive -DestinationPath $installDir
151+
$installDir >> $env:GITHUB_PATH
152+
& "$installDir\pwsh.exe" -NoProfile -NonInteractive -Command '$PSVersionTable; [System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture'
153+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
154+
132155
# Windows installs straight from the registry. There, linking the packages
133156
# takes the time, not downloading them, so a ~700 MB package cache did not
134157
# pay for its own restore. Across recent nightlies, restore plus install

0 commit comments

Comments
 (0)