|
1 | 1 | #!/usr/bin/env pwsh
|
2 | 2 |
|
3 |
| -param ([Parameter(Mandatory)] $Version, [Parameter(Mandatory)][SecureString] $CertPassword) |
| 3 | +param ( |
| 4 | + [Parameter(Mandatory)] $Version, |
| 5 | + [Parameter(Mandatory)][SecureString] $CertPassword, |
| 6 | + $CertPath = "$env:USERPROFILE\Documents\Certificates\EcsactDev.pfx" |
| 7 | +) |
4 | 8 |
|
5 | 9 | $ErrorActionPreference = 'Stop'
|
6 | 10 |
|
| 11 | +$MakeAppxPath = "${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.22621.0\x64\makeappx.exe" |
| 12 | +$SignToolPath = "${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.22621.0\x64\signtool.exe" |
| 13 | + |
7 | 14 | $CertPasswordPlain = ConvertFrom-SecureString -SecureString $CertPassword -AsPlainText
|
8 |
| -$CertPath = "$env:USERPROFILE\Documents\Certificates\EcsactDev.pfx" |
9 | 15 |
|
10 | 16 | try {
|
11 | 17 | ((Get-Content -path .\dist\AppxManifest.xml -Raw) -replace '0.0.0.0-placeholder',"$($Version).0") | Set-Content -Path .\dist\AppxManifest.xml
|
12 | 18 | $MsixPath = "ecsact_sdk_$($Version)_windows_x64.msix"
|
13 |
| - MSIXHeroCLI pack -d dist -p $MsixPath |
14 |
| - MSIXHeroCLI sign --file $CertPath -p $CertPasswordPlain $MsixPath |
| 19 | + |
| 20 | + & $SignToolPath sign ` |
| 21 | + /debug /fd SHA384 ` |
| 22 | + /f $CertPath ` |
| 23 | + /p $CertPasswordPlain ` |
| 24 | + /tr http://timestamp.sectigo.com /td SHA256 ` |
| 25 | + .\dist\bin\ecsact.exe ` |
| 26 | + .\dist\bin\ecsact_rtb.exe |
| 27 | + |
| 28 | + if(-not $?) { |
| 29 | + throw "Signing dist binaries failed with exit code ${LastExitCode}" |
| 30 | + } |
| 31 | + |
| 32 | + & $MakeAppxPath pack /v /o /h SHA384 /d .\dist\ /p $MsixPath |
| 33 | + |
| 34 | + if(-not $?) { |
| 35 | + throw "$MakeAppxPath exited with ${LastExitCode}" |
| 36 | + } |
| 37 | + |
| 38 | + & $SignToolPath sign ` |
| 39 | + /debug /fd SHA384 ` |
| 40 | + /f $CertPath ` |
| 41 | + /p $CertPasswordPlain ` |
| 42 | + /tr http://timestamp.sectigo.com /td SHA256 ` |
| 43 | + $MsixPath |
| 44 | + if(-not $?) { |
| 45 | + throw "Signing ${MsixPath} failed with exit code ${LastExitCode}" |
| 46 | + } |
15 | 47 | } finally {
|
16 | 48 | git checkout .\dist\AppxManifest.xml
|
17 | 49 | }
|
0 commit comments