1
1
$currentDirectory = split-path $MyInvocation.MyCommand.Definition
2
2
3
3
# See if we have the ClientSecret available
4
- if ([string ]::IsNullOrEmpty($env: SignClientSecret )) {
4
+ if ([string ]::IsNullOrEmpty($env: VaultSignClientSecret )) {
5
5
Write-Host " Client Secret not found, not signing packages"
6
6
return ;
7
7
}
8
8
9
- dotnet tool install -- tool- path . SignClient
9
+ dotnet tool install -- tool- path . sign -- version 0.9 . 1 - beta. 25278.1
10
10
11
- # Setup Variables we need to pass into the sign client tool
12
- $appSettings = " $currentDirectory \SignClient.json"
11
+ $filesToSign = Get-ChildItem - Recurse $Env: ArtifactDirectory \* - Include * .nupkg | Select-Object - ExpandProperty FullName
13
12
14
- $filesToSign = Get-ChildItem - Recurse $Env: ArtifactDirectory \* - Include * .nupkg, * .vsix | Select-Object - ExpandProperty FullName
15
-
16
- foreach ($fileToSign in $filesToSign ) {
13
+ foreach ($fileToSign in $filesToSign )
14
+ {
17
15
Write-Host " Submitting $fileToSign for signing"
18
- .\SignClient ' sign' - c $appSettings - i $fileToSign - r $env: SignClientUser - s $env: SignClientSecret - n " $env: SignPackageName " - d " $env: SignPackageDescription " - u " $env: build_repository_uri "
19
- Write-Host " Finished signing $fileToSign "
20
- }
21
16
22
- Write-Host " Sign-package complete"
17
+ .\sign code azure- key- vault `
18
+ $fileToSign `
19
+ -- publisher- name " $env: SignPackageName " `
20
+ -- description " $env: SignPackageDescription " `
21
+ -- description- url " $env: build_repository_uri " `
22
+ -- azure- key- vault- tenant- id " $env: VaultSignTenantId " `
23
+ -- azure- key- vault- client- id " $env: VaultSignClientId " `
24
+ -- azure- key- vault- client- secret " $env: VaultSignClientSecret " `
25
+ -- azure- key- vault- certificate " $env: VaultSignCertificate " `
26
+ -- azure- key- vault- url " $env: VaultSignUrl " `
27
+ -- verbosity information
28
+
29
+ if ($LASTEXITCODE -ne 0 ) {
30
+ Write-Error " Failed to sign $fileToSign "
31
+ exit $LASTEXITCODE
32
+ }
33
+
34
+ Write-Host " Finished signing $fileToSign "
35
+ }
0 commit comments