forked from NuGetPackageExplorer/NuGetPackageExplorer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
288 lines (240 loc) · 11.3 KB
/
azure-pipelines.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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
trigger:
- main
- rel/*
pr:
- main
- rel/*
stages:
- stage: Build
variables:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
BuildConfiguration: Release
jobs:
- job: Build
pool:
vmImage: windows-latest
strategy:
matrix:
Channel_Zip:
ReleaseChannel: Zip
Channel_Store:
ReleaseChannel: Store
Channel_Nightly:
ReleaseChannel: Nightly
Channel_Choco:
ReleaseChannel: Choco
Channel_WebAssembly:
ReleaseChannel: WebAssembly
Channel_UnoSkia:
ReleaseChannel: UnoSkia
steps:
- task: UseDotNet@2
displayName: 'Use .NET 5 SDK'
inputs:
version: 5.x
- task: UseDotNet@2
displayName: 'Use .NET 6 SDK'
inputs:
version: 6.x
includePreviewVersions: true
#- pwsh: |
# $branch = "release/5.0.1xx"
# $scriptPath = Join-Path $env:AGENT_TOOLSDIRECTORY dotnet-install.ps1
# Invoke-WebRequest -OutFile $scriptPath https://raw.githubusercontent.com/dotnet/install-scripts/master/src/dotnet-install.ps1
# &"$scriptPath" -Channel $branch
# $configFile = Join-Path $env:AGENT_TOOLSDIRECTORY NuGet-darc.config
# # Get the darc feeds needed
# Invoke-WebRequest -OutFile $configFile "https://raw.githubusercontent.com/dotnet/installer/$branch/NuGet.config"
# [xml]$nugetConfig = Get-Content $configFile
# $darcNodes = $nugetConfig.SelectNodes("/configuration/packageSources/add[starts-with(@key, 'darc-')]")
# $installationPath = Join-Path $env:AGENT_TOOLSDIRECTORY dotnet
# Write-Host "##vso[task.setvariable variable=DOTNET_ROOT]$installationPath"
# # Enable multi-level lookup to fall back to the built-in SDK's for older versions. Set to 0 to disable
# Write-Host "##vso[task.setvariable variable=DOTNET_MULTILEVEL_LOOKUP]1"
# # Make sure the new path is propagated back to the main host process
# Write-Host "##vso[task.setvariable variable=PATH]$env:PATH"
# # Add the nightly NuGet feeds to the nuget config starting with the darc nodes
# foreach ($feed in $darcNodes) {
# $key = $feed.attributes['key'].value
# $value = $feed.attributes['value'].value
# Write-Host "Adding DARC feed '$key': $value"
# dotnet nuget add source $value -n $key
# }
# dotnet nuget add source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json -n dotnet5
# displayName: Intall .NET 5.0 SDK
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: tool
arguments: install --tool-path . nbgv
displayName: Install NBGV tool
- script: nbgv cloud -c -a
displayName: Set Version
- powershell: |
mkdir $(Build.ArtifactStagingDirectory)\$(ReleaseChannel)
# Set versions
# Update appxmanifests. These must be done before build.
[xml]$manifest = Get-Content ".\PackageExplorer.Package\package.appxmanifest"
$manifest.Package.Identity.Version = "$(GitBuildVersionSimple).0"
$manifest.Save(".\PackageExplorer.Package\package.appxmanifest")
[xml]$manifest = Get-Content ".\PackageExplorer.Package\Package-Nightly.appxmanifest"
$manifest.Package.Identity.Version = "$(GitBuildVersionSimple).0"
$manifest.Save(".\PackageExplorer.Package\Package-Nightly.appxmanifest")
# Update badges
[xml]$badge = Get-Content ".\Build\ci_badge.svg"
$badge.svg.g[1].text[2].InnerText = "$(GitBuildVersionSimple).0"
$badge.svg.g[1].text[3].InnerText = "$(GitBuildVersionSimple).0"
$badge.Save("$(Build.ArtifactStagingDirectory)\$(ReleaseChannel)\ci_badge.svg")
[xml]$badge = Get-Content ".\Build\store_badge.svg"
$badge.svg.g[1].text[2].InnerText = "$(GitBuildVersionSimple).0"
$badge.svg.g[1].text[3].InnerText = "$(GitBuildVersionSimple).0"
$badge.Save("$(Build.ArtifactStagingDirectory)\$(ReleaseChannel)\stable_badge.svg")
displayName: Update manifest and badge versions
- powershell: |
# Update App Insights key
[xml]$doc = Get-Content ".\PackageExplorer\ApplicationInsights.config"
$doc.ApplicationInsights.ConnectionString = "$(AppInsightsKey)"
$doc.Save(".\PackageExplorer\ApplicationInsights.config")
displayName: Set AppInsights Config
env:
AppInsightsKey: $(AppInsightsKey)
condition: and(succeeded(), not(eq(variables['build.reason'], 'PullRequest')), not(eq(variables['AppInsightsKey'], '')))
- task: MSBuild@1
displayName: Build Package
inputs:
solution: PackageExplorer.Package/PackageExplorer.Package.wapproj
msbuildArguments: /restore /p:AppxPackageDir="$(Build.ArtifactStagingDirectory)\$(ReleaseChannel)\\" /bl:$(Build.ArtifactStagingDirectory)\Logs\$(ReleaseChannel).binlog
configuration: $(BuildConfiguration)
maximumCpuCount: true
condition: and(succeeded(), or(eq(variables['ReleaseChannel'], 'Nightly'), eq(variables['ReleaseChannel'], 'Store')))
- task: DotNetCoreCLI@2
displayName: Build for Zip and Choco
inputs:
command: publish
projects: 'PackageExplorer/NuGetPackageExplorer.csproj'
arguments: -c $(BuildConfiguration) /p:PublishProfile=Properties/PublishProfiles/WinX64.pubxml /bl:$(Build.ArtifactStagingDirectory)\Logs\$(ReleaseChannel).binlog
zipAfterPublish: false
modifyOutputPath: false
publishWebProjects: false
condition: and(succeeded(), or(eq(variables['ReleaseChannel'], 'Zip'), eq(variables['ReleaseChannel'], 'Choco')))
- task: DotNetCoreCLI@2
displayName: Pack Libraries as Package
inputs:
command: pack
arguments: /bl:$(Build.ArtifactStagingDirectory)\Logs\Libraries.binlog
packagesToPack: '**/*.csproj;!**/NuGetPackageExplorer.csproj;!**/*.macOS.csproj'
configuration: $(BuildConfiguration)
packDirectory: $(Build.ArtifactStagingDirectory)\$(ReleaseChannel)\NuGet
condition: and(succeeded(), eq(variables['ReleaseChannel'], 'Zip'))
- powershell: |
# Chocolatey
& choco.exe pack .\PackageExplorer\NuGetPackageExplorer.nuspec --version $(NBGV_ChocolateyPackageVersion) --OutputDirectory $(Build.ArtifactStagingDirectory)\$(ReleaseChannel)
displayName: Create Choco package
condition: and(succeeded(), eq(variables['ReleaseChannel'], 'Choco'))
- task: ArchiveFiles@1
displayName: Zip Windows PackageExplorer files
inputs:
archiveType: zip
rootFolder: PackageExplorer/bin/$(BuildConfiguration)/net6.0-windows10.0.19041/win-x64/publish
archiveFile: $(Build.ArtifactStagingDirectory)\$(ReleaseChannel)\PackageExplorer.$(Build.BuildNumber).zip
includeRootFolder: false
condition: and(succeeded(), eq(variables['ReleaseChannel'], 'Zip'))
- task: MSBuild@1
displayName: Build Uno Apps
inputs:
solution: $(build.sourcesdirectory)/NuGetPackageExplorer-uno.slnf
msbuildArguments: /r /p:Configuration=Release /p:UNO_BUILD_ONLY=true /p:NpeAiInstrumentationKey=$(AppInsightsKeyWebAssembly) /bl:$(Build.ArtifactStagingDirectory)\Logs\$(ReleaseChannel).binlog
maximumCpuCount: true
condition: and(succeeded(), or(eq(variables['ReleaseChannel'], 'Nightly'), eq(variables['ReleaseChannel'], 'WebAssembly'), eq(variables['ReleaseChannel'], 'UnoSkia')))
- task: ArchiveFiles@1
displayName: Zip Gtk PackageExplorer files
inputs:
archiveType: zip
rootFolder: $(build.sourcesdirectory)/Uno/NuGetPackageExplorer.Skia.Gtk/bin/Release/net5.0
archiveFile: $(Build.ArtifactStagingDirectory)\$(ReleaseChannel)\PackageExplorer.Skia.Gtk.$(Build.BuildNumber).zip
includeRootFolder: false
condition: and(succeeded(), eq(variables['ReleaseChannel'], 'UnoSkia'))
- task: CopyFiles@2
displayName: Copy WebAssembly Package
inputs:
SourceFolder: '$(build.sourcesdirectory)/Uno/NuGetPackageExplorer.Wasm/bin/Release/net5.0/dist'
Contents: '**'
TargetFolder: $(build.artifactstagingdirectory)\$(ReleaseChannel)
CleanTargetFolder: false
OverWrite: false
flattenFolders: false
condition: and(succeeded(), eq(variables['ReleaseChannel'], 'WebAssembly'))
- publish: '$(build.sourcesdirectory)/Uno/Api'
displayName: Publish Cors bypass Azure Function
artifact: CorsAzureFunction
condition: and(succeeded(), eq(variables['ReleaseChannel'], 'WebAssembly'))
- publish: $(Build.ArtifactStagingDirectory)\$(ReleaseChannel)
displayName: Publish Build Packages
artifact: $(ReleaseChannel)
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: $(Build.ArtifactStagingDirectory)\Logs
artifactName: Logs
displayName: Publish Build Logs
condition: always()
- publish: Build
displayName: Publish signing scripts
artifact: SigningScripts
- stage: CodeSign
condition: and(succeeded('Build'), not(eq(variables['build.reason'], 'PullRequest')))
jobs:
- deployment: CodeSign
displayName: Code Signing
pool:
vmImage: windows-latest
environment: Code Sign - CI
variables:
- group: NuGet Package Explorer Sign Client
strategy:
runOnce:
deploy:
steps:
- task: DownloadPipelineArtifact@2
displayName: Download Zip Artifacts
inputs:
artifactName: Zip
targetPath: $(Pipeline.Workspace)/ToSign/Zip
- task: DownloadPipelineArtifact@2
displayName: Download Choco Artifacts
inputs:
artifactName: Choco
targetPath: $(Pipeline.Workspace)/ToSign/Choco
- task: DownloadPipelineArtifact@2
displayName: Download Nightly Artifacts
inputs:
artifactName: Nightly
targetPath: $(Pipeline.Workspace)/ToSign/Nightly
- download: current
artifact: SigningScripts
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: tool
arguments: install --tool-path . SignClient
displayName: Install SignTool tool
- pwsh: |
.\SignClient "Sign" `
--baseDirectory "$(Pipeline.Workspace)\ToSign" `
--input "**/*.{appxbundle,appinstaller,zip,nupkg}" `
--config "$(Pipeline.Workspace)\SigningScripts\appsettings.json" `
--filelist "$(Pipeline.Workspace)\SigningScripts\filelist.txt" `
--user "$(SignClientUser)" `
--secret '$(SignClientSecret)' `
--name "NuGet Package Explorer" `
--description "NuGet Package Explorer" `
--descriptionUrl "https://github.com/NuGetPackageExplorer/NuGetPackageExplorer"
displayName: Authenticode Sign artifacts
- publish: $(Pipeline.Workspace)/ToSign/Zip
displayName: Publish Signed Zip Packages
artifact: ZipSigned
- publish: $(Pipeline.Workspace)/ToSign/Choco
displayName: Publish Signed Choco Packages
artifact: ChocoSigned
- publish: $(Pipeline.Workspace)/ToSign/Nightly
displayName: Publish Signed Choco Packages
artifact: NightlySigned