-
-
Notifications
You must be signed in to change notification settings - Fork 519
/
.azure-pipelines.yml
178 lines (157 loc) · 6.43 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
trigger:
branches:
include:
- master
- review/*
- experiment/*
- dev
paths:
exclude:
- '**/*.md'
- '.github/**/*'
pr:
branches:
include:
- dev
paths:
exclude:
- '**/*.md'
- '.github/**/*'
variables:
- group: 'Bugsnag'
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
value: true
- name: Solution
value: 'EarTrumpet.vs15.sln'
- name: BuildConfiguration
value: 'Release'
- name: BuildPlatform
value: 'x86'
jobs:
- job: Build
continueOnError: 'false'
pool:
vmImage: vs2017-win2016
strategy:
matrix:
AppInstaller:
Channel: AppInstaller
Publisher: 'CN=File-New-Project, O=File-New-Project, L=Purcellville, S=Virginia, C=US'
Store:
Channel: Store
Publisher: 'CN=6099D0EF-9374-47ED-BDFE-A82136831235'
maxParallel: 2
steps:
- task: GitVersion@4
displayName: 'Initialize Git Version'
inputs:
updateAssemblyInfo: false
- task: PowerShell@2
displayName: 'Set build number'
inputs:
targetType: inline
script: |
Write-Host "##vso[build.updatebuildnumber]$(GitVersion.SemVer)"
- task: PowerShell@2
displayName: 'Generate versioning metadata'
inputs:
targetType: inline
script: |
New-Item -ItemType Directory "$(Build.ArtifactStagingDirectory)\Metadata" -ErrorAction Ignore
Set-Content "$(Build.ArtifactStagingDirectory)\Metadata\semver.txt" "$(GitVersion.SemVer)"
Set-Content "$(Build.ArtifactStagingDirectory)\Metadata\branch.txt" "$(GitVersion.BranchName)"
Set-Content "$(Build.ArtifactStagingDirectory)\Metadata\commits.txt" "$(GitVersion.CommitsSinceVersionSource)"
if("$(Channel)" -eq "Store") {
$Version = "$(GitVersion.MajorMinorPatch).0"
} else {
$Version = "$(GitVersion.AssemblySemVer)"
}
Set-Content "$(Build.ArtifactStagingDirectory)\Metadata\$(Channel).version.txt" $Version
- task: NuGetToolInstaller@0
displayName: 'Install NuGet Tooling'
- task: NuGetCommand@2
displayName: 'Restore NuGet Packages'
inputs:
restoreSolution: '$(solution)'
- task: PowerShell@2
displayName: 'Set Bugsnag API Key'
inputs:
targetType: inline
script: |
$cfg = Get-Content ".\EarTrumpet\app.config"
$cfg | ForEach-Object { $_.Replace("{bugsnag.apikey}", "$(bugsnag.apikey)") } | Set-Content ".\EarTrumpet\app.config"
- task: PowerShell@2
displayName: 'Adjust manifest and store association'
inputs:
targetType: inline
script: |
$manifestPath = ".\EarTrumpet.Package\Package.appxmanifest"
$storeAssociationPath = ".\EarTrumpet.Package\Package.StoreAssociation.xml"
$manifest = [xml](Get-Content $manifestPath)
$manifest.Package.Identity.Publisher = "$(Publisher)"
if("$(Channel)" -eq "AppInstaller") {
$manifest.Package.Properties.DisplayName = "EarTrumpet ($(GitVersion.BranchName))"
$manifest.Package.Applications.Application.VisualElements.DisplayName = "EarTrumpet ($(GitVersion.BranchName))"
}
$manifest.Save($manifestPath)
$storeAssociation = [xml](Get-Content $storeAssociationPath)
$storeAssociation.StoreAssociation.Publisher = "$(Publisher)"
if("$(Channel)" -eq "AppInstaller") {
$storeAssociation.StoreAssociation.ProductReservedInfo.ReservedNames.ReservedName = "EarTrumpet ($(GitVersion.BranchName))"
}
$storeAssociation.Save($storeAssociationPath)
- task: MSBuild@1
displayName: 'Build EarTrumpet appxupload package'
inputs:
solution: 'EarTrumpet.Package/EarTrumpet.Package.wapproj'
platform: 'x86'
configuration: '$(buildConfiguration)'
msbuildArguments: '/p:AppxBundle=Always /p:Channel=$(Channel) /p:AppxPackageDir="$(Build.ArtifactStagingDirectory)/AppxUpload" /p:AppxPackageSigningEnabled=false /p:UapAppxPackageBuildMode=CI'
maximumCpuCount: true
condition: and(succeeded(), eq(variables['Channel'], 'Store'))
- task: PublishBuildArtifacts@1
displayName: 'Publish appxupload artifacts'
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)/AppxUpload'
artifactName: 'AppxUpload'
condition: and(succeeded(), eq(variables['Channel'], 'Store'))
- task: MSBuild@1
displayName: 'Build EarTrumpet appinstaller/sideload package'
inputs:
solution: 'EarTrumpet.Package/EarTrumpet.Package.wapproj'
platform: 'x86'
configuration: '$(buildConfiguration)'
msbuildArguments: '/p:AppxBundle=Always /p:Channel=$(Channel) /p:AppxPackageDir="$(Build.ArtifactStagingDirectory)/Sideload" /p:AppxPackageSigningEnabled=false /p:UapAppxPackageBuildMode=SideloadOnly /p:GenerateAppInstallerFile=true /p:AppxPackageTestDir="$(Build.ArtifactStagingDirectory)/Sideload/" /p:AppInstallerUri=https://install.eartrumpet.app'
maximumCpuCount: true
condition: and(succeeded(), eq(variables['Channel'], 'AppInstaller'))
- task: PowerShell@2
displayName: 'Adjust appinstaller manifest'
inputs:
targetType: inline
script: |
$manifestPath = "$(Build.ArtifactStagingDirectory)/Sideload/EarTrumpet.Package.appinstaller"
$manifest = [xml](Get-Content $manifestPath)
$manifest.AppInstaller.Uri = "https://install.eartrumpet.app/$(GitVersion.BranchName)/EarTrumpet.Package.appinstaller"
$manifest.AppInstaller.MainBundle.Uri = "https://install.eartrumpet.app/$(GitVersion.BranchName)/EarTrumpet.Package_$(GitVersion.MajorMinorPatch).$(GitVersion.CommitsSinceVersionSource)_x86.appxbundle"
$manifest.AppInstaller.MainBundle.Publisher = "$(Publisher)"
$manifest.Save($manifestPath)
pwsh: true
condition: and(succeeded(), eq(variables['Channel'], 'AppInstaller'))
- task: PublishBuildArtifacts@1
displayName: 'Publish appinstaller/sideload package artifacts'
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)/Sideload'
artifactName: 'Sideload'
condition: and(succeeded(), eq(variables['Channel'], 'AppInstaller'))
- task: CopyFiles@2
displayName: 'Stage packaging metadata'
inputs:
SourceFolder: 'Packaging'
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)/Metadata/Packaging'
condition: and(succeeded(), eq(variables['Channel'], 'Store'))
- task: PublishBuildArtifacts@1
displayName: 'Publish metadata artifacts'
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)/Metadata'
artifactName: 'Metadata'