This repository has been archived by the owner on Apr 30, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 28
/
azure-pipelines-package-alpha.yml
144 lines (126 loc) · 5.24 KB
/
azure-pipelines-package-alpha.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
# Universal Windows Platform
# Build a Universal Windows Platform project using Visual Studio.
# Add steps that test and distribute an app, save build artifacts, and more:
# https://aka.ms/yaml
resources:
repositories:
- repository: QuarrelInstaller
type: github
endpoint: Connection
name: QuarrelForDiscord/QuarrelInstaller
trigger:
branches:
include:
- 'rewrite/alpha'
pr: none
pool:
vmImage: 'windows-latest'
variables:
solution: '**/Quarrel.sln'
buildPlatform: 'x86|x64|arm|arm64'
buildConfiguration: 'Alpha'
installerDirectory: './QuarrelInstaller'
appxPackageDir: '$(build.artifactStagingDirectory)\AppxPackages\\'
buildDir: '$(build.artifactStagingDirectory)\build\\'
msixUploads: '$(appxPackageDir)\**\\*.msixupload'
msixBundles: '$(appxPackageDir)\**\\*.msixbundle'
msixPackages: '$(appxPackageDir)\**\\*.msix'
appInstaller: '$(installerDirectory)\Quarrel.appinstaller'
siteUri: 'https://quarrelfordiscord.github.io/QuarrelInstaller/'
dailyNumber: $[counter(format('{0:yyyyMMdd}', pipeline.startTime), 0)]
steps:
- checkout: self
- checkout: QuarrelInstaller
persistCredentials: true
- task: DownloadSecureFile@1
displayName: Get Signing Certificate
name: signingCertificate
inputs:
secureFile: 'Quarrel-Alpha_Key.pfx'
- task: DownloadSecureFile@1
displayName: Get AppCenterToken
name: appCenterToken
inputs:
secureFile: 'AppCenterAlpha.json'
- task: PowerShell@2
displayName: Place AppCenterToken
inputs:
targetType: 'inline'
script: 'Copy-Item $Env:APP_CENTER_TOKEN_PATH -Destination "$($Env:BUILD_SOURCESDIRECTORY)\Quarrel\src\Quarrel\Assets\Tokens\AppCenter\"'
env:
APP_CENTER_TOKEN_PATH: $(appCenterToken.secureFilePath)
- powershell: |
# Update appxmanifest. This must be done before the build.
[xml]$manifest= get-content "$($Env:BUILD_SOURCESDIRECTORY)\Quarrel\src\Quarrel\Package.Alpha.appxmanifest";
$manifest.Package.Identity.Version = "$(Get-Date -format "y.M.d").$(dailyNumber)";
$manifest.save("$($Env:BUILD_SOURCESDIRECTORY)\Quarrel\src\Quarrel\Package.Alpha.appxmanifest");
displayName: 'Version Package Manifest'
- task: NuGetToolInstaller@1
displayName: 'NuGet Installer'
- task: NuGetCommand@2
displayName: 'NuGet Restore'
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
displayName: 'Build'
inputs:
solution: '$(solution)'
platform: 'x64'
configuration: '$(buildConfiguration)'
msbuildArgs: '/t:Quarrel
/p:AppxBundlePlatforms="$(buildPlatform)"
/p:AppxPackageDir="$(appxPackageDir)"
/p:OutputPath="$(buildDir)"
/p:AppxBundle=Always
/p:AppxPackageSigningEnabled=true
/p:PackageCertificateKeyFile="$(signingCertificate.secureFilePath)"
/p:PackageCertificateThumbprint="$(SignedCertificateThumbprint-Alpha)"
/p:PackageCertificatePassword="$(SignCertificatePassword-Alpha)"
/p:AppInstallerUri="$(siteUri)"
/p:AppInstallerUpdateFrequency=1
/p:AppInstallerCheckForUpdateFrequency=OnApplicationRun
/p:GenerateAppInstallerFile=true'
- powershell: |
[Reflection.Assembly]::LoadWithPartialName("System.Xml.Linq")
$doc = [System.Xml.Linq.XDocument]::Load(
"$(appxPackageDir)/Quarrel.appinstaller")
$xName = "{http://schemas.microsoft.com/appx/appinstaller/2017/2}MainBundle";
$bundle = $doc.Root.Element($xName).Attribute("Uri").Value.Replace("$(siteUri)", "");
Copy-Item "$(appxPackageDir)\$($bundle)" -Destination "$(build.artifactStagingDirectory)\$($bundle.Replace("/", "_"))";
$doc.Root.Element($xName).Attribute("Uri").Value =
"https://github.com/UWPCommunity/Quarrel/releases/download/alpha-v$(Build.BuildNumber)/$($bundle.Replace("/", "_"))";
$xName = "{http://schemas.microsoft.com/appx/appinstaller/2017/2}Dependencies";
foreach ($element in $doc.Root.Element($xName).Elements()){
$dep = $element.Attribute("Uri").Value.Replace("$(siteUri)", "");
Copy-Item "$(appxPackageDir)\$($dep)" -Destination "$(build.artifactStagingDirectory)\$($dep.Replace("/", "_"))";
$element.Attribute("Uri").Value =
"https://github.com/UWPCommunity/Quarrel/releases/download/alpha-v$(Build.BuildNumber)/$($dep.Replace("/", "_"))";
}
$doc.Save("$(appInstaller)")
displayName: 'Fix appinstaller'
- task: GitHubRelease@1
displayName: 'Create GitHub release'
inputs:
gitHubConnection: 'Avid29'
repositoryName: 'UWPCommunity/Quarrel'
action: 'create'
target: '$(Build.SourceVersion)'
tag: "alpha-v$(Build.BuildNumber)"
tagSource: 'userSpecifiedTag'
title: 'Alpha-v$(Build.BuildNumber)'
isPreRelease: true
changeLogCompareToRelease: 'lastFullRelease'
changeLogType: 'commitBased'
assets: |
$(build.artifactStagingDirectory)\*.msixbundle
$(build.artifactStagingDirectory)\*.appx
- script: |
git config --global user.email $(GitHub-Email)
git config --global user.name "Azure Pipelines"
git add *
git commit -m "Update to $(Build.BuildNumber)"
git remote -v
echo 'test'
git push origin HEAD:refs/heads/master
displayName: Push to QuarrelInstaller repo
workingDirectory: $(installerDirectory)