Skip to content

Commit fe2d8a0

Browse files
committed
infra: use pwsh
1 parent d74277b commit fe2d8a0

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ jobs:
309309
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
310310
run: |
311311
Write-Host "Starting Windows build..." -ForegroundColor Cyan
312-
powershell -ExecutionPolicy Bypass -File scripts\build-win.ps1
312+
pwsh -ExecutionPolicy Bypass -File scripts\build-win.ps1
313313
314314
- name: Find Windows ZIP file
315315
id: find_zip

scripts/build-win.ps1

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
# Build Windows package
22
# This script handles the electron-builder failures gracefully
33

4-
Write-Host "`n========================================" -ForegroundColor Cyan
5-
Write-Host "Building Windows Package" -ForegroundColor Cyan
6-
Write-Host "========================================`n" -ForegroundColor Cyan
4+
Write-Host "`n========================================" -ForegroundColor Cyan
5+
Write-Host 'Building Windows Package' -ForegroundColor Cyan
6+
Write-Host '========================================' -ForegroundColor Cyan
7+
Write-Host ''
78

89
# Set environment variables
910
$env:NODE_ENV = "production"
1011
$env:ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES = "true"
1112

1213
# Run electron-builder with --dir to create win-unpacked
1314
# We ignore the exit code because it may fail on winCodeSign but still create win-unpacked
14-
Write-Host "Running electron-builder..." -ForegroundColor Yellow
15+
Write-Host 'Running electron-builder...' -ForegroundColor Yellow
1516

1617
try {
1718
npx electron-builder --win --x64 --dir 2>&1 | Out-Host
1819
} catch {
1920
Write-Host "`nelectron-builder encountered errors" -ForegroundColor Yellow
2021
}
2122

22-
Write-Host "`nChecking if win-unpacked was created..." -ForegroundColor Yellow
23+
Write-Host 'Checking if win-unpacked was created...' -ForegroundColor Yellow
24+
Write-Host ''
2325

2426
# Check if win-unpacked exists
2527
$scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Path
@@ -28,23 +30,25 @@ $distPath = Join-Path -Path $projectRoot -ChildPath "dist"
2830
$unpackedPath = Join-Path -Path $distPath -ChildPath "win-unpacked"
2931

3032
if (Test-Path $unpackedPath) {
31-
Write-Host "✓ win-unpacked directory found" -ForegroundColor Green
32-
Write-Host "Proceeding to create ZIP package...`n" -ForegroundColor Green
33+
Write-Host '✓ win-unpacked directory found' -ForegroundColor Green
34+
Write-Host 'Proceeding to create ZIP package...' -ForegroundColor Green
35+
Write-Host ''
3336

3437
# Run the pack script
3538
$packScript = Join-Path -Path $scriptPath -ChildPath "pack-windows.js"
3639
node $packScript
3740

3841
if ($LASTEXITCODE -eq 0) {
39-
Write-Host "`nWindows package built successfully!`n" -ForegroundColor Green
42+
Write-Host "`nWindows package built successfully!" -ForegroundColor Green
43+
Write-Host ''
4044
exit 0
4145
} else {
42-
Write-Host "`nZIP packaging failed`n" -ForegroundColor Red
46+
Write-Host "`nZIP packaging failed" -ForegroundColor Red
47+
Write-Host ''
4348
exit 1
4449
}
4550
} else {
46-
Write-Host "`nwin-unpacked directory not found at: $unpackedPath" -ForegroundColor Red
47-
Write-Host "electron-builder failed to create the unpacked directory" -ForegroundColor Red
51+
Write-Host ("`nwin-unpacked directory not found at: {0}" -f $unpackedPath) -ForegroundColor Red
52+
Write-Host 'electron-builder failed to create the unpacked directory' -ForegroundColor Red
4853
exit 1
4954
}
50-

0 commit comments

Comments
 (0)