CMake/.gitlab/ci/signtool-env.ps1
Brad King 1f46bc299b ci: Extend packaging pipeline to sign Windows binaries automatically
Split packaging on Windows into dedicated jobs that run with access to
an EV signing certificate.

Prior to commit 0929221ca3 (gitlab-ci: Simplify Windows packaging
pipeline, 2023-02-28, v3.26.0-rc5~3^2~3) we had separate packaging jobs,
but they did not run in release packaging pipelines.  Restore them, and
run them in both nightly and release packaging pipelines.
2025-03-19 11:22:30 -04:00

23 lines
826 B
PowerShell

if ("$env:PROCESSOR_ARCHITECTURE" -eq "AMD64") {
$arch = "x64"
} elseif ("$env:PROCESSOR_ARCHITECTURE" -eq "ARM64") {
$arch = "arm64"
} else {
throw ('unknown PROCESSOR_ARCHITECTURE: ' + "$env:PROCESSOR_ARCHITECTURE")
}
$regKey = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0'
$signtoolPath = $null
if ($sdkDir = Get-ItemPropertyValue -Path $regKey -Name "InstallationFolder") {
if ($sdkBin = Get-ChildItem -Path "$sdkDir/bin" -Recurse -Name "$arch" |
Where-Object { Test-Path -Path "$sdkDir/bin/$_/signtool.exe" -PathType Leaf } |
Select-Object -Last 1) {
$signtoolPath = "$sdkDir/bin/$sdkBin"
}
}
if ($signtoolPath) {
Set-Item -Force -Path "env:PATH" -Value "$env:PATH;$signtoolPath"
} else {
throw ('No signtool.exe found in Windows SDK')
}