Mimic macOS bundling behavior for Windows builds (#61180)

Rei-mplements the logic from
https://github.com/zed-industries/zed/blob/cf028dbd3ef1edf1d09027458d208821be7e8976/script/bundle-mac#L120-L123
for Windows bundling so that `run-bundling` label in CI can build
unsigned Windows binaries properly.

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov authored and GitHub committed 2026-07-17 09:01:06 +00:00
1 parent df0ab34aed
commit 84430455ad
2 files changed
+28 -12

No files matched your search

+1 -1
View File
@@ -31,7 +31,7 @@ WizardStyle=modern
CloseApplications=force
#if GetEnv("CI") != ""
#if GetEnv("ZED_SIGN_BUNDLE") != ""
SignTool=Defaultsign
#endif
+27 -11
View File
@@ -13,6 +13,7 @@ $ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true
$buildSuccess = $false
$canCodeSign = $false
$OSArchitecture = switch ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture) {
"X64" { "x86_64" }
@@ -66,18 +67,31 @@ function CheckEnvironmentVariables {
return
}
$requiredVars = @(
'ZED_WORKSPACE', 'RELEASE_VERSION', 'ZED_RELEASE_CHANNEL',
$requiredVars = @('ZED_WORKSPACE', 'RELEASE_VERSION', 'ZED_RELEASE_CHANNEL')
foreach ($var in $requiredVars) {
if ([string]::IsNullOrWhiteSpace([Environment]::GetEnvironmentVariable($var))) {
Write-Error "$var is not set"
exit 1
}
}
# On PRs from forks the signing secrets are not populated,
# so skip code signing instead of failing, like bundle-mac does.
$signingVars = @(
'AZURE_TENANT_ID', 'AZURE_CLIENT_ID', 'AZURE_CLIENT_SECRET',
'ACCOUNT_NAME', 'CERT_PROFILE_NAME', 'ENDPOINT',
'FILE_DIGEST', 'TIMESTAMP_DIGEST', 'TIMESTAMP_SERVER'
)
foreach ($var in $requiredVars) {
if (-not (Test-Path "env:$var")) {
Write-Error "$var is not set"
exit 1
}
$missingVars = @($signingVars | Where-Object { [string]::IsNullOrWhiteSpace([Environment]::GetEnvironmentVariable($_)) })
if ($missingVars.Count -eq 0) {
$script:canCodeSign = $true
} else {
Write-Host "====== WARNING ======"
Write-Host "One or more of the following variables are missing: $($missingVars -join ', ')"
Write-Host "This bundle will not be code signed"
Write-Host "====== WARNING ======"
}
}
@@ -128,7 +142,7 @@ function BuildRemoteServer {
# Create zipped remote server binary
$remoteServerSrc = (Resolve-Path ".\$CargoOutDir\remote_server.exe").Path
if ($env:CI) {
if ($canCodeSign) {
Write-Output "Code signing remote_server.exe"
& "$innoDir\sign.ps1" $remoteServerSrc
}
@@ -159,7 +173,7 @@ function UploadToSentry {
Write-Output "install with: 'winget install -e --id=Sentry.sentry-cli'"
return
}
if (-not (Test-Path "env:SENTRY_AUTH_TOKEN")) {
if ([string]::IsNullOrWhiteSpace($env:SENTRY_AUTH_TOKEN)) {
Write-Output "missing SENTRY_AUTH_TOKEN. skipping sentry upload."
return
}
@@ -200,7 +214,7 @@ function MakeAppx {
}
function SignZedAndItsFriends {
if (-not $env:CI) {
if (-not $canCodeSign) {
return
}
@@ -340,7 +354,9 @@ function BuildInstaller {
}
$innoArgs = @($issFilePath) + $defs
if($env:CI) {
if($canCodeSign) {
# Checked by zed.iss to decide whether to sign the installer.
$env:ZED_SIGN_BUNDLE = "1"
$signTool = "powershell.exe -ExecutionPolicy Bypass -File $innoDir\sign.ps1 `$f"
$innoArgs += "/sDefaultsign=`"$signTool`""
}