/
azure-pipelines.yml
256 lines (217 loc) · 9.41 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
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 8 SDK'
inputs:
version: 8.x
- 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'
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)/net8.0-windows10.0.22000/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/net8.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/net8.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
dependsOn: Build
condition: and(succeeded('Build'), not(eq(variables['build.reason'], 'PullRequest')))
jobs:
- job: CodeSign
displayName: Code Signing
pool:
vmImage: windows-latest
variables:
- group: SignCLI Config
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: UseDotNet@2
displayName: 'Use .NET SDK 8.x'
inputs:
version: 8.x
# Install the code signing tool
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: tool
arguments: install --tool-path . --prerelease sign
displayName: Install SignTool tool
- task: AzureCLI@2
inputs:
azureSubscription: 'Azure RM (NPE)'
scriptType: pscore
scriptLocation: inlineScript
inlineScript: |
.\sign code azure-key-vault `
"**/*.{appxbundle,msixbundle,appinstaller,zip,nupkg}" `
--base-directory "$(Pipeline.Workspace)\ToSign" `
--file-list "$(Pipeline.Workspace)\SigningScripts\filelist.txt" `
--publisher-name "NuGet Package Explorer" `
--description "NuGet Package Explorer" `
--description-url "https://github.com/NuGetPackageExplorer/NuGetPackageExplorer" `
--azure-key-vault-managed-identity `
--azure-key-vault-certificate "$(SignKeyVaultCertificate)" `
--azure-key-vault-url "$(SignKeyVaultUrl)"
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