forked from microsoft/winget-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.nuget.yml
213 lines (191 loc) · 8.08 KB
/
azure-pipelines.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
trigger: none
parameters:
- name: version
displayName: Version to stamp on binaries and nuget package. Should be in form of "major.minor", for example "1.0"
type: string
pool:
vmImage: "windows-latest"
variables:
solution: "src/AppInstallerCLI.sln"
packageName: Microsoft.WindowsPackageManager.Utils
buildVer: $[counter(${{ parameters.version }}, 1)]
version: ${{ parameters.version }}.$(buildVer)
EnableDetectorVcpkg: true
jobs:
- job: "Build"
timeoutInMinutes: 120
strategy:
matrix:
x86_release:
buildConfiguration: 'Release'
buildPlatform: 'x86'
x64_release:
buildConfiguration: 'Release'
buildPlatform: 'x64'
variables:
artifactsDir: $(Build.ArtifactStagingDirectory)\$(buildPlatform)
steps:
- script: echo $(version)
- task: NuGetToolInstaller@1
displayName: Install Nuget
# Restores all projects, including native (vcxproj) projects
- task: NuGetCommand@2
displayName: Restore Solution
inputs:
restoreSolution: "$(solution)"
# Restore these UAP packages as https://github.com/NuGet/Home/issues/7796 leads to all UAP packages being skipped for restore.
# Even though they don't need any actual restore action, they need the project.assets.json file to be created and a direct restore does that.
- task: NuGetCommand@2
displayName: Restore AppInstallerCLIPackage
inputs:
restoreSolution: 'src\AppInstallerCLIPackage\AppInstallerCLIPackage.wapproj'
- task: NuGetCommand@2
displayName: Restore AppInstallerTestMsixInstaller
inputs:
restoreSolution: 'src\AppInstallerTestMsixInstaller\AppInstallerTestMsixInstaller.wapproj'
# Restores only .NET core projects, but is still necessary, as without this the IndexCreationTool and LocalhostWebServer projects fail to build
- task: DotNetCoreCLI@2
displayName: DotNet Restore
inputs:
command: "restore"
projects: "**/*.csproj"
- task: CmdLine@2
displayName: Enable Vcpkg Install
inputs:
script: |
$(VCPKG_INSTALLATION_ROOT)\vcpkg.exe integrate install
workingDirectory: '$(VCPKG_INSTALLATION_ROOT)'
- task: PowerShell@2
displayName: Update Binary Version
condition: not(eq(variables['Build.Reason'], 'PullRequest'))
inputs:
filePath: 'src\binver\Update-BinVer.ps1'
arguments: '-TargetFile binver\binver\version.h -BuildVersion $(buildVer) -MajorMinorOverride ${{ parameters.version }}'
workingDirectory: "src"
- task: VSBuild@1
displayName: Build Solution
inputs:
platform: "$(buildPlatform)"
solution: "$(solution)"
configuration: "$(buildConfiguration)"
- task: EsrpCodeSigning@5
displayName: "ESRP CodeSigning - Package contents"
inputs:
ConnectedServiceName: "WindowsPackageManager ESRP CodeSigning"
AppRegistrationClientId: '32216f16-efc9-4013-9fae-c6a2c54a3fc0'
AppRegistrationTenantId: '72f988bf-86f1-41af-91ab-2d7cd011db47'
AuthAKVName: 'PeetDevOpsKeyVault'
AuthCertName: 'ESRPAuth'
AuthSignCertName: 'ESRPRequestSigning'
FolderPath: src
Pattern: |
*\$(buildConfiguration)\WinGetUtil\WinGetUtil.dll
WinGetUtilInterop\bin\$(buildConfiguration)\netstandard2.1\WinGetUtilInterop.dll
UseMinimatch: true
signConfigType: inlineSignParams
inlineOperation: |
[
{
"KeyCode" : "CP-230012",
"OperationCode" : "SigntoolSign",
"Parameters" : {
"OpusName" : "Microsoft",
"OpusInfo" : "http://www.microsoft.com",
"FileDigest" : "/fd \"SHA256\"",
"PageHash" : "/NPH",
"TimeStamp" : "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
},
"ToolName" : "sign",
"ToolVersion" : "1.0"
},
{
"KeyCode" : "CP-230012",
"OperationCode" : "SigntoolVerify",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
}
]
- task: CopyFiles@2
displayName: 'Copy nuget pack files to artifacts folder'
inputs:
Contents: |
WinGetUtil.nuspec
src\$(buildPlatform)\$(buildConfiguration)\WinGetUtil\WinGetUtil.dll
src\$(buildPlatform)\$(buildConfiguration)\WinGetUtil\WinGetUtil.pdb
src\WinGetUtilInterop\bin\$(buildConfiguration)\netstandard2.1\WinGetUtilInterop.dll
src\WinGetUtilInterop\bin\$(buildConfiguration)\netstandard2.1\WinGetUtilInterop.pdb
src\WinGetUtilInterop\build\Microsoft.WindowsPackageManager.Utils.targets
schemas\JSON\manifests\**
TargetFolder: '$(artifactsDir)'
- task: PublishPipelineArtifact@1
displayName: Publish Pipeline Artifacts
inputs:
targetPath: '$(artifactsDir)'
- job: "Nuget"
timeoutInMinutes: 60
dependsOn: 'Build'
steps:
- checkout: none
- task: DownloadPipelineArtifact@2
displayName: 'Download Build.x64release artifacts'
inputs:
artifactName: Build.x64release
targetPath: '$(Pipeline.Workspace)\Build.x64release'
- task: DownloadPipelineArtifact@2
displayName: 'Download Build.x86release artifacts'
inputs:
artifactName: Build.x86release
targetPath: '$(Pipeline.Workspace)\Build.x86release'
- task: NuGetCommand@2
displayName: Pack WingetUtil nuget package
inputs:
command: pack
packagesToPack: '$(Pipeline.Workspace)\Build.x64release\WinGetUtil.nuspec'
versioningScheme: byEnvVar
versionEnvVar: version
packDestination: '$(Build.ArtifactStagingDirectory)'
basePath: $(Pipeline.Workspace)
- task: EsrpCodeSigning@5
displayName: "ESRP CodeSigning - NuGet package"
inputs:
ConnectedServiceName: "WindowsPackageManager ESRP CodeSigning"
AppRegistrationClientId: '32216f16-efc9-4013-9fae-c6a2c54a3fc0'
AppRegistrationTenantId: '72f988bf-86f1-41af-91ab-2d7cd011db47'
AuthAKVName: 'PeetDevOpsKeyVault'
AuthCertName: 'ESRPAuth'
AuthSignCertName: 'ESRPRequestSigning'
FolderPath: "$(Build.ArtifactStagingDirectory)"
Pattern: "$(packageName).$(version).nupkg"
signConfigType: inlineSignParams
inlineOperation: |
[
{
"KeyCode" : "CP-401405",
"OperationCode" : "NuGetSign",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
},
{
"KeyCode" : "CP-401405",
"OperationCode" : "NuGetVerify",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
}
]
- task: PublishBuildArtifacts@1
displayName: Publish nuget package to artifacts
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\$(packageName).$(version).nupkg'
ArtifactName: $(packageName)
publishLocation: Container
- task: NuGetCommand@2
displayName: Push WingetUtil nuget package to nuget.org
inputs:
command: push
nuGetFeedType: external
includeNugetOrg: true
packagesToPush: '$(Build.ArtifactStagingDirectory)\$(packageName).$(version).nupkg'
publishFeedCredentials: "WindowsPackageManagerAzurePipelineNuget - NuGet.org"