[Tool] Script to build an installer locally (#39017)

* add script to build a installer

* minor fix

* fix search path for msix file

* fix sign

* fix sign

* fix spelling

* Fix powershell5 can't recognize emoji

* ensure-wix

* bring cmdpal available during local build

* remove early quit

* fix marco

* add logger

* doc

* add a note

* self review

* fix macro def

* add functionality to export cert so that other machine can install it.

* spelling
This commit is contained in:
Kai Tao
2025-04-25 09:57:42 +08:00
committed by GitHub
parent f63fcfd91c
commit fc804a8156
9 changed files with 411 additions and 10 deletions

View File

@@ -0,0 +1,29 @@
param (
[string]$certSubject = "CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US",
[string[]]$TargetPaths = "C:\PowerToys\ARM64\Release\WinUI3Apps\CmdPal\AppPackages\Microsoft.CmdPal.UI_0.0.1.0_Test\Microsoft.CmdPal.UI_0.0.1.0_arm64.msix"
)
. "$PSScriptRoot\cert-management.ps1"
$cert = EnsureCertificate -certSubject $certSubject
if (-not $cert) {
Write-Error "Failed to prepare certificate."
exit 1
}
Write-Host "Certificate ready: $($cert.Thumbprint)"
if (-not $TargetPaths -or $TargetPaths.Count -eq 0) {
Write-Error "No target files provided to sign."
exit 1
}
foreach ($filePath in $TargetPaths) {
if (-not (Test-Path $filePath)) {
Write-Warning "Skipping: File does not exist - $filePath"
continue
}
Write-Host "Signing: $filePath"
& signtool sign /sha1 $($cert.Thumbprint) /fd SHA256 /t http://timestamp.digicert.com "$filePath"
}