-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathnuget.yml
132 lines (111 loc) · 5.61 KB
/
nuget.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
steps:
- task: DownloadPipelineArtifact@2
inputs:
buildType: current
artifactName: release
targetPath: "$(System.ArtifactsDirectory)/release"
displayName: Download native packages
- task: DownloadPipelineArtifact@2
inputs:
buildType: current
artifactName: signed
targetPath: "$(System.ArtifactsDirectory)/signed"
displayName: Download signed windows native packages
- powershell: |
$null = New-Item $(PackageRoot) -ItemType Directory -Force -Verbose
if(-not (Test-Path '$(System.ArtifactsDirectory)/release' ))
{
New-Item -ItemType Directory -Path '$(System.ArtifactsDirectory)/release' -Force
}
Invoke-WebRequest -Uri '$(PSRPBlobUrl)' -OutFile $(System.ArtifactsDirectory)/release/psrp.zip -Verbose
displayName: 'Download PSRP package'
- powershell: 'Get-ChildItem $(System.ArtifactsDirectory)/release'
displayName: 'Capture downloaded zips'
- powershell: |
$extractedRoot = New-Item $(System.ArtifactsDirectory)/uncompressed -ItemType Directory -Force -Verbose
Get-ChildItem $(System.ArtifactsDirectory)/release/*.zip | ForEach-Object {
$baseName = $_.BaseName
if($baseName -match 'x64_arm') {
Write-Verbose "Skipping expanding file $_.Name" -Verbose
}
else {
$folderPath = Join-Path $extractedRoot $baseName
Expand-Archive $_.FullName -DestinationPath $folderPath -Force
}
}
Write-Host "Extracted files:"
Get-ChildItem -Recurse $extractedRoot -File
displayName: 'Extract All Zips'
- template: upload.yml
parameters:
fileName: 'x64_arm64-symbols.zip'
sourcePath: '$(System.ArtifactsDirectory)\release\x64_arm64-symbols.zip'
- template: upload.yml
parameters:
fileName: 'x64-symbols.zip'
sourcePath: '$(System.ArtifactsDirectory)\release\x64-symbols.zip'
- template: upload.yml
parameters:
fileName: 'x64_arm-symbols.zip'
sourcePath: '$(System.ArtifactsDirectory)\release\x64_arm-symbols.zip'
- template: upload.yml
parameters:
fileName: 'x86-symbols.zip'
sourcePath: '$(System.ArtifactsDirectory)\release\x86-symbols.zip'
- task: NuGetToolInstaller@0
displayName: 'Install NuGet 5.3.1'
inputs:
versionSpec: 5.3.1
- template: setVersion.yml
- powershell: |
Import-Module $(Build.SourcesDirectory)\build.psm1
$PackageRoot = New-Item -ItemType Directory -Path $(System.ArtifactsDirectory)\NugetPackage
$WindowsX64ZipPath = Join-Path "$(System.ArtifactsDirectory)/signed" 'win-x64.zip'
$WindowsX86ZipPath = Join-Path "$(System.ArtifactsDirectory)/signed" 'win-x86.zip'
$WindowsARMZipPath = Join-Path "$(System.ArtifactsDirectory)/signed" 'win-x64_arm.zip'
$WindowsARM64ZipPath = Join-Path "$(System.ArtifactsDirectory)/signed" 'win-x64_arm64.zip'
$LinuxZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-x64-symbols.zip'
$LinuxARMZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-arm-symbols.zip'
$LinuxARM64ZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-arm64-symbols.zip'
$LinuxAlpineZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-musl-x64-symbols.zip'
$LinuxAlpineArm64ZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'linux-musl-arm64-symbols.zip'
$macOSZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'osx-symbols.zip'
$psrpZipPath = Join-Path "$(System.ArtifactsDirectory)/release" 'psrp.zip'
Start-BuildPowerShellNativePackage -PackageRoot $PackageRoot -Version $(PackageVersion) -WindowsX64ZipPath $WindowsX64ZipPath -WindowsX86ZipPath $WindowsX86ZipPath -WindowsARMZipPath $WindowsARMZipPath -WindowsARM64ZipPath $WindowsARM64ZipPath -LinuxZipPath $LinuxZipPath -LinuxARMZipPath $LinuxARMZipPath -LinuxARM64ZipPath $LinuxARM64ZipPath -LinuxAlpineZipPath $LinuxAlpineZipPath -LinuxAlpineArm64ZipPath $LinuxAlpineArm64ZipPath -macOSZipPath $macOSZipPath -psrpZipPath $psrpZipPath -NuGetOutputPath $(NuGetPackagePath)
displayName: 'Build NuGet package'
- powershell: 'Get-Childitem $(NuGetPackagePath)'
displayName: 'Capture nuget package'
- template: EsrpSign.yml@ComplianceRepo
parameters:
# the folder which contains the binaries to sign
buildOutputPath: $(NuGetPackagePath)
# the location to put the signed output
signOutputPath: '$(System.ArtifactsDirectory)\signed'
# the certificate ID to use
certificateId: "CP-401405"
# The file pattern to use
# If not using minimatch: comma separated, with * supported
# If using minimatch: newline separated, with !, **, and * supported.
# See link in the useMinimatch comments.
pattern: '*.nupkg'
# decides if the task should use minimatch for the pattern matching.
# https://github.com/isaacs/minimatch#features
useMinimatch: false
- powershell: |
Copy-Item $(NuGetPackagePath)\*.nupkg -DestinationPath '$(System.ArtifactsDirectory)\signed' -Force -Verbose
displayName: Copy unsigned nuget packge as signing is disabled
condition: eq(variables['SkipSigning'], 'True')
- powershell: |
Import-Module $env:BUILD_SOURCESDIRECTORY\build.psm1 -Force
$packages = Get-ChildItem -Recurse $(System.ArtifactsDirectory)\signed\*.nupkg -Verbose
if ($packages.Count -eq 0)
{
throw "No signed package found at: $(System.ArtifactsDirectory)\signed"
}
$packages | ForEach-Object { Start-NativeExecution -sb { nuget.exe verify -All $_.FullName } }
displayName: 'Validate NuGet package is signed'
- template: uploadArtifact.yml
parameters:
artifactPath: '$(System.ArtifactsDirectory)\signed'
artifactFilter: 'Microsoft.PowerShell.Native.$(PackageVersion).nupkg'
artifactName: 'finalResults'