/
azure-pipelines-release.yml
258 lines (225 loc) · 8.47 KB
/
azure-pipelines-release.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
trigger: none
pr: none
pool:
vmImage: 'windows-latest'
parameters:
- name: releaseBranch
displayName: Release Branch
type: string
default: 'preview'
values:
- 'preview'
- 'stable'
- name: packageIdentityName
displayName: Package Identity Name
type: string
default: 'FilesPreview'
values:
- 'FilesPreview'
- 'Files'
- name: packageDisplayName
displayName: Package Display Name
type: string
default: 'Files (Preview)'
values:
- 'Files (Preview)'
- 'Files'
variables:
- group: BuildPipelineVariables
- name: solution
value: '**/*.sln'
- name: buildPlatform
value: 'x64|arm64'
- name: buildConfiguration
value: 'Release'
- name: sideloadBuildConfiguration
value: 'Sideload'
- name: appxPackageDir
value: '$(build.artifactStagingDirectory)\AppxPackages\\'
jobs:
### Sideload release ###
- job: SideloadRelease
timeoutInMinutes: 120
steps:
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
[xml]$xmlDoc = Get-Content $(Build.SourcesDirectory)\src\Files.Package\Package.appxmanifest
$xmlDoc.Package.Identity.Name="${{parameters.packageIdentityName}}"
$xmlDoc.Package.Identity.Publisher="Files"
$xmlDoc.Package.Properties.DisplayName="${{parameters.packageDisplayName}}"
$xmlDoc.Package.Applications.Application.VisualElements.DisplayName="${{parameters.packageDisplayName}}"
$xmlDoc.Save('$(Build.SourcesDirectory)\src\Files.Package\Package.appxmanifest')
failOnStderr: true
# This replaces references to the dev icon with the regular release icon
- task: PowerShell@2
displayName: 'Use Correct Logo'
inputs:
targetType: 'inline'
script: |
gci $(Build.SourcesDirectory)\src -Include *.csproj, *.appxmanifest, *.wapproj -recurse | ForEach -Process {
(Get-Content $_ -Raw | ForEach -Process {$_ -replace "Assets\\AppTilesDev", "Assets\AppTiles"}) | Set-Content $_ -NoNewline
}
failOnStderr: true
- task: DownloadSecureFile@1
name: mapsDevKey
displayName: 'Download Bing Maps Dev Key'
inputs:
secureFile: 'BingMapsKey.txt'
# Adds the Bing maps token to the project
- task: CopyFiles@2
inputs:
SourceFolder: '$(Agent.TempDirectory)'
Contents: '$(mapsDevKey.secureFilePath)'
TargetFolder: '$(Build.SourcesDirectory)\src\Files.Uwp\Resources'
overWrite: true
- task: DownloadSecureFile@1
name: appCenterDevKey
displayName: 'Download AppCenter Dev Key'
inputs:
secureFile: 'AppCenterKey.txt'
# Adds the AppCenter token to the project
- task: CopyFiles@2
inputs:
SourceFolder: '$(Agent.TempDirectory)'
Contents: '$(appCenterDevKey.secureFilePath)'
TargetFolder: '$(Build.SourcesDirectory)\src\Files.Uwp\Resources'
overWrite: true
- task: UseDotNet@2
inputs:
packageType: sdk
version: 6.0.100
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
feedsToUse: config
nugetConfigPath: nuget.config
restoreSolution: '$(solution)'
- task: DownloadSecureFile@1
name: caCertificate
displayName: 'Download CA certificate'
inputs:
secureFile: '$(signingCert.secureFilePath)'
- task: MSBuild@1
inputs:
solution: '**/*.wapproj'
platform: 'x86'
configuration: '$(sideloadBuildConfiguration)'
msbuildArguments: '/t:build;_GenerateAppxPackage /p:AppxLogTelemetryFromSideloadingScript=False /p:GenerateAppInstallerFile=True /p:AppInstallerUri=https://cdn.files.community/files/${{parameters.releaseBranch}}/ /p:AppxBundlePlatforms="$(buildPlatform)" /p:AppxPackageDir="$(appxPackageDir)" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=Sideload /p:AppxPackageSigningEnabled=true /p:PackageCertificateKeyFile="$(caCertificate.secureFilePath)" /p:PackageCertificatePassword="$(signingCert.password)" /p:PackageCertificateThumbprint=""'
maximumCpuCount: true
- task: CopyFiles@2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(system.defaultworkingdirectory)'
Contents: '**\bin\$(sideloadBuildConfiguration)\**'
TargetFolder: '$(build.artifactstagingdirectory)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: Sideload'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: 'Sideload'
publishLocation: 'Container'
- task: AzureFileCopy@4
inputs:
SourcePath: '$(build.artifactstagingdirectory)\AppxPackages\*'
azureSubscription: 'azureconnection'
Destination: 'AzureBlob'
storage: 'filescommunity'
ContainerName: 'files'
BlobPrefix: '${{parameters.releaseBranch}}'
### Store release ###
- job: StoreRelease
timeoutInMinutes: 120
steps:
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
[xml]$xmlDoc = Get-Content $(Build.SourcesDirectory)\src\Files.Package\Package.appxmanifest
$xmlDoc.Package.Identity.Name="49306atecsolution.FilesUWP"
$xmlDoc.Package.Identity.Publisher="CN=53EC4384-7F5B-4CF6-8C23-513FFE9D1AB7"
$xmlDoc.Package.Properties.DisplayName="Files"
$xmlDoc.Package.Applications.Application.VisualElements.DisplayName="Files"
# Removes packageManagement from Store release
$nsmgr = New-Object System.Xml.XmlNamespaceManager($xmlDoc.NameTable)
$nsmgr.AddNamespace("pkg", "http://schemas.microsoft.com/appx/manifest/foundation/windows10")
$nsmgr.AddNamespace("rescap", "http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities")
$pm = $xmlDoc.SelectSingleNode("/pkg:Package/pkg:Capabilities/rescap:Capability[@Name='packageManagement']", $nsmgr)
$xmlDoc.Package.Capabilities.RemoveChild($pm)
$xmlDoc.Save('$(Build.SourcesDirectory)\src\Files.Package\Package.appxmanifest')
failOnStderr: true
# This replaces references to the dev icon with the regular release icon
- task: PowerShell@2
displayName: 'Use Release Logo'
inputs:
targetType: 'inline'
script: |
gci $(Build.SourcesDirectory)\src -Include *.csproj, *.appxmanifest, *.wapproj -recurse | ForEach -Process {
(Get-Content $_ -Raw | ForEach -Process {$_ -replace "Assets\\AppTilesDev", "Assets\AppTiles"}) | Set-Content $_ -NoNewline
}
failOnStderr: true
# Adds the Bing maps token to the project
- task: DownloadSecureFile@1
name: mapsDevKey
displayName: 'Download Bing Maps Dev Key'
inputs:
secureFile: 'BingMapsKey.txt'
- task: CopyFiles@2
inputs:
SourceFolder: '$(Agent.TempDirectory)'
Contents: '$(mapsDevKey.secureFilePath)'
TargetFolder: '$(Build.SourcesDirectory)\src\Files.Uwp\Resources'
overWrite: true
# Adds the AppCenter token to the project
- task: DownloadSecureFile@1
name: appCenterDevKey
displayName: 'Download AppCenter Dev Key'
inputs:
secureFile: 'AppCenterKey.txt'
- task: CopyFiles@2
inputs:
SourceFolder: '$(Agent.TempDirectory)'
Contents: '$(appCenterDevKey.secureFilePath)'
TargetFolder: '$(Build.SourcesDirectory)\src\Files.Uwp\Resources'
overWrite: true
- task: UseDotNet@2
inputs:
packageType: sdk
version: 6.0.100
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
feedsToUse: config
nugetConfigPath: nuget.config
restoreSolution: '$(solution)'
- task: MSBuild@1
inputs:
solution: '**/*.wapproj'
platform: 'x86'
configuration: '$(buildConfiguration)'
msbuildArguments: '/t:build;_GenerateAppxPackage /p:AppxBundlePlatforms="$(buildPlatform)" /p:AppxPackageDir="$(appxPackageDir)" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload'
maximumCpuCount: true
- task: CopyFiles@2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(system.defaultworkingdirectory)'
Contents: '**\bin\$(BuildConfiguration)\**'
TargetFolder: '$(build.artifactstagingdirectory)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: Store'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: 'Store'
publishLocation: 'Container'
- task: store-flight@0
inputs:
serviceEndpoint: 'Files'
appId: '9NGHP3DX8HDX'
flightName: 'Files - Preview'
packagePath: '$(appxPackageDir)\**\*.msixupload'
force: false
skipPolling: false
deletePackages: true
numberOfPackagesToKeep: '5'
isMandatoryUpdate: true