|
4 | 4 | [String] $PsGalleryApiKey, |
5 | 5 | [String] $NugetApiKey, |
6 | 6 | [String] $ChocolateyApiKey, |
7 | | - [String] $CertificateThumbprint = '2FCC9148EC2C9AB951C6F9654C0D2ED16AF27738', |
| 7 | + [String] $TenantId, |
| 8 | + [String] $VaultUrl, |
| 9 | + [String] $CertificateName, |
8 | 10 | [Switch] $Force |
9 | 11 | ) |
10 | 12 |
|
@@ -52,7 +54,7 @@ if ((Get-Item $bin/Pester.psm1).Length -lt 50KB) { |
52 | 54 | throw "Module is too small, are you publishing non-inlined module?" |
53 | 55 | } |
54 | 56 |
|
55 | | -& "$PSScriptRoot/signModule.ps1" -Thumbprint $CertificateThumbprint -Path $bin |
| 57 | +& "$PSScriptRoot/signModule.ps1" -VaultUrl $VaultUrl -TenantId $TenantId -CertificateName $CertificateName -Path $bin |
56 | 58 |
|
57 | 59 | $files = @( |
58 | 60 | 'Pester.ps1' |
@@ -128,8 +130,23 @@ Get-ChildItem -Path $bin -Filter *.dll -Recurse | ForEach-Object { |
128 | 130 | } |
129 | 131 |
|
130 | 132 | & nuget pack "$PSScriptRoot/Pester.nuspec" -OutputDirectory $nugetDir -NoPackageAnalysis -version $version |
131 | | -$nupkg = (Join-Path $nugetDir "Pester.$version.nupkg") |
132 | | -& nuget sign $nupkg -CertificateFingerprint $CertificateThumbprint -Timestamper "http://timestamp.digicert.com" |
| 133 | +[string] $nupkg = (Join-Path $nugetDir "Pester.$version.nupkg") |
| 134 | + |
| 135 | +dotnet tool install --global NuGetKeyVaultSignTool |
| 136 | +if (0 -ne $LASTEXITCODE) { |
| 137 | + throw "Failed to install NuGetKeyVaultSignTool" |
| 138 | +} |
| 139 | + |
| 140 | +Write-Host "Nuget path: $nupkg" |
| 141 | +NuGetKeyVaultSignTool sign -kvu $VaultUrl -kvm -kvc $CertificateName -kvt $TenantId -own "nohwnd,fflaten" -tr "http://timestamp.digicert.com" $nupkg |
| 142 | +if (0 -ne $LASTEXITCODE) { |
| 143 | + throw "Failed to sign nupkg" |
| 144 | +} |
| 145 | + |
| 146 | +NuGetKeyVaultSignTool verify $nupkg |
| 147 | +if (0 -ne $LASTEXITCODE) { |
| 148 | + throw "Failed to verify nupkg" |
| 149 | +} |
133 | 150 |
|
134 | 151 | Publish-Module -Path $psGalleryDir -NuGetApiKey $PsGalleryApiKey -Verbose -Force |
135 | 152 |
|
|
0 commit comments