-
Notifications
You must be signed in to change notification settings - Fork 200
/
azure-pipelines.yml
168 lines (155 loc) · 6.44 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
trigger:
branches:
include:
- main
- 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: 'ModernFlyouts.sln'
- name: BuildConfiguration
value: 'Release'
- name: BuildPlatform
value: 'x86 , x64'
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 ".\ModernFlyouts\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 = ".\ModernFlyouts.Package\Package.appxmanifest"
$storeAssociationPath = ".\ModernFlyouts.Package\Package.StoreAssociation.xml"
$manifest = [xml](Get-Content $manifestPath)
$manifest.Package.Identity.Publisher = "$(Publisher)"
if("$(Channel)" -eq "AppInstaller") {
$manifest.Package.Properties.DisplayName = "ModernFlyouts ($(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 ModernFlyouts appxupload package'
inputs:
solution: 'ModernFlyouts.Package/EarTrModernFlyouts.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 ModernFlyouts appinstaller/sideload package'
inputs:
solution: 'ModernFlyouts.Package/ModernFlyouts.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/ModernFlyouts.Package.appinstaller"
$manifest = [xml](Get-Content $manifestPath)
$manifest.AppInstaller.Uri = "https://install.ModernFlyouts.app/$(GitVersion.BranchName)/ModernFlyouts.Package.appinstaller"
$manifest.AppInstaller.MainBundle.Uri = "https://install.ModernFlyouts.app/$(GitVersion.BranchName)/ModernFlyouts.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'