-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
azure-pipelines.yml
179 lines (154 loc) · 9.32 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
trigger:
- main
- store
pr:
- main
pool:
vmImage: "windows-latest"
variables:
- name: solution
value: "**/*.sln"
- name: buildPlatform
value: "x64"
- name: buildConfiguration
value: "Release"
- name: publishDirectory
value: "Pack/Output"
- name: artifactDirectory
value: "Pack/Zip"
- group: AppCenter
- group: Protected
parameters:
- name: "plugins"
type: object
default:
- "plugin_Kinect360"
- "plugin_KinectOne"
- "plugin_PSMoveService"
- "plugin_owoTrackVR"
- "plugin_OpenVR"
- "plugin_OSC"
name: 1.2.$(Date:yyyyMMdd).$(Rev:r)
stages:
- stage: Build
jobs:
- job: Publish
steps:
- checkout: self
submodules: true | recursive
persistCredentials: "true"
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: "$(solution)"
- pwsh: |
((Get-Content -path .\Amethyst\Amethyst.csproj -Raw) -replace 'AZ_BUILD_DATA-->', "") | Set-Content -Path .\Amethyst\Amethyst.csproj
((Get-Content -path .\Amethyst\Amethyst.csproj -Raw) -replace '<!--AZ_BUILD_DATA', "") | Set-Content -Path .\Amethyst\Amethyst.csproj
((Get-Content -path .\Amethyst\Amethyst.csproj -Raw) -replace 'AZ_BUILD_NUMBER', "$(Build.BuildNumber)") | Set-Content -Path .\Amethyst\Amethyst.csproj
((Get-Content -path .\Amethyst\Classes\AppData.cs -Raw) -replace 'AZ_BUILD_NUMBER', "$(Build.BuildNumber)") | Set-Content -Path .\Amethyst\Classes\AppData.cs
displayName: Add version data to Amethyst
- pwsh: |
((Get-Content -path .\Amethyst\Classes\AppData.cs -Raw) -replace 'AZ_API_TOKEN', "$(AppToken)") | Set-Content -Path .\Amethyst\Classes\AppData.cs
((Get-Content -path .\Amethyst\App.xaml.cs -Raw) -replace 'AZ_COMMIT_SHA', "$(Build.SourceVersion)") | Set-Content -Path .\Amethyst\App.xaml.cs
((Get-Content -path .\Amethyst\App.xaml.cs -Raw) -replace 'AZ_APPSECRET', "$(AppSecret)") | Set-Content -Path .\Amethyst\App.xaml.cs
(((Get-Content -path .\Amethyst\Pages\Info.xaml -Raw) -replace '<!--AZ_COMMIT_DATA', '') -replace 'AZ_COMMIT_DATA-->', '') | Set-Content -Path .\Amethyst\Pages\Info.xaml
((Get-Content -path .\Amethyst\Pages\Info.xaml -Raw) -replace 'AZ_COMMIT_SHA', "$("$(Build.SourceVersion)".Substring(0,7))") | Set-Content -Path .\Amethyst\Pages\Info.xaml
((Get-Content -path .\Amethyst\Pages\Info.xaml -Raw) -replace 'AZ_COMMIT_LINK', "https://github.com/KinectToVR/Amethyst/commit/$(Build.SourceVersion)") | Set-Content -Path .\Amethyst\Pages\Info.xaml
displayName: Add commit data to Amethyst
- pwsh: |
((Get-Content -path .\Amethyst\Classes\AppData.cs -Raw) -replace 'AZ_APPCENTER_SECRET', "$(Amethyst_AppSecret)") | Set-Content -Path .\Amethyst\Classes\AppData.cs
((Get-Content -path .\Amethyst\Classes\AppData.cs -Raw) -replace 'AZ_APPCENTER_RO_TOKEN', "$(UserApiToken_ReadOnly)") | Set-Content -Path .\Amethyst\Classes\AppData.cs
displayName: Add API keys to Amethyst
- pwsh: |
Write-Host "##vso[task.setvariable variable=PackageVersion;]$(([xml](Get-Content .\Amethyst\Package.appxmanifest)).Package.Identity.Version)"
Write-Host "##vso[task.setvariable variable=packageVersion;isOutput=true;]$(([xml](Get-Content .\Amethyst\Package.appxmanifest)).Package.Identity.Version)"
displayName: Prepare package version variables
name: ParseAppxManifest
- task: DownloadSecureFile@1
name: signingCert
displayName: Download the signing certificate
inputs:
secureFile: "Amethyst_TestingKey.pfx"
- ${{each plugin in parameters.plugins}}:
- task: DownloadGitHubRelease@0
displayName: "Download plugin ${{ plugin }}"
inputs:
connection: github.com_KimihikoAkayasaki
userRepository: "KinectToVR/${{ plugin }}"
defaultVersionType: latest
version: latest
downloadPath: $(artifactDirectory)
- task: ExtractFiles@1
displayName: "Pack plugin ${{ plugin }}"
inputs:
archiveFilePatterns: "$(artifactDirectory)/${{ plugin }}.zip"
destinationFolder: "Amethyst/Plugins/${{ plugin }}"
cleanDestinationFolder: false
- pwsh: Import-PfxCertificate -CertStoreLocation Cert:\CurrentUser\My -FilePath "$(signingCert.secureFilePath)" -Password $(ConvertTo-SecureString "$(PackageCertificatePassword)" -AsPlainText -Force)
displayName: Import the signing certificate
- task: VSBuild@1
displayName: Build (publish) Amethyst - Unsigned
inputs:
platform: "$(buildPlatform)"
solution: "$(solution)"
configuration: "$(buildConfiguration)"
msbuildArgs:
'/t:Amethyst /p:Platform=$(buildPlatform) /p:PlatformTarget=$(buildPlatform) /p:Configuration=$(buildConfiguration) /p:GenerateAppxPackageOnBuild=true
/p:RuntimeIdentifier=win10-$(buildPlatform) /t:Amethyst /p:PublishProfile=Amethyst\Properties\PublishProfiles\win10-$(buildPlatform).pubxml
/p:AppxBundlePlatforms="$(buildPlatform)" /p:AppxPackageDir="bin\$(buildConfiguration)\net7.0\win10-$(buildPlatform)\deploy\\"
/p:AppxBundle=Always /p:UapAppxPackageBuildMode=SideloadOnly /p:AppxPackageSigningEnabled=false'
- task: CopyFiles@2
displayName: Pack Amethyst - Unsigned
inputs:
SourceFolder: 'Amethyst\bin\$(buildConfiguration)\net7.0\win10-$(buildPlatform)\deploy\Amethyst_$(packageVersion)_Test'
Contents: "Amethyst_$(packageVersion)_$(buildPlatform).msix"
TargetFolder: $(Build.ArtifactStagingDirectory)
preserveTimestamp: true
- publish: "$(Build.ArtifactStagingDirectory)/Amethyst_$(packageVersion)_$(buildPlatform).msix"
displayName: Publish Amethyst - Unsigned
artifact: pack
- task: VSBuild@1
displayName: Build (publish) Amethyst - Signed
inputs:
platform: "$(buildPlatform)"
solution: "$(solution)"
configuration: "$(buildConfiguration)"
msbuildArgs:
'/t:Amethyst /p:Platform=$(buildPlatform) /p:PlatformTarget=$(buildPlatform) /p:Configuration=$(buildConfiguration) /p:GenerateAppxPackageOnBuild=true
/p:RuntimeIdentifier=win10-$(buildPlatform) /t:Amethyst /p:PublishProfile=Amethyst\Properties\PublishProfiles\win10-$(buildPlatform).pubxml
/p:AppxBundlePlatforms="$(buildPlatform)" /p:AppxPackageDir="bin\$(buildConfiguration)\net7.0\win10-$(buildPlatform)\deploy\\"
/p:AppxBundle=Always /p:UapAppxPackageBuildMode=SideloadOnly /p:AppxPackageSigningEnabled=true /p:PackageCertificateKeyFile="$(signingCert.secureFilePath)"
/p:PackageCertificateThumbprint="3C288874D8146BC9860512DAC28ED51528B8C39F" /p:PackageCertificatePassword="$(PackageCertificatePassword)"'
- task: PowerShell@2
displayName: Pack Amethyst - Signed
inputs:
targetType: inline
script: Copy-Item -Path "Amethyst\bin\$(buildConfiguration)\net7.0\win10-$(buildPlatform)\deploy\Amethyst_$(packageVersion)_Test\Amethyst_$(packageVersion)_$(buildPlatform).msix" -Destination "$(Build.ArtifactStagingDirectory)/Amethyst_$(packageVersion)_$(buildPlatform)_TestSigned.msix"
- publish: "$(Build.ArtifactStagingDirectory)/Amethyst_$(packageVersion)_$(buildPlatform)_TestSigned.msix"
displayName: Publish Amethyst - Signed
artifact: signed
- stage: Stage
dependsOn: Build
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
jobs:
- job: Artifacts
variables:
packageVersion: $[ stageDependencies.Build.Publish.outputs['ParseAppxManifest.PackageVersion'] ]
steps:
- checkout: self
persistCredentials: "true"
- download: current
displayName: Download published artifacts
artifact: signed
- task: AppCenterDistribute@3
displayName: Upload packed Amethyst artifact (AppCenter)
inputs:
serverEndpoint: K2VR
appSlug: K2VR/Amethyst
appFile: "$(Pipeline.Workspace)/signed/Amethyst_$(packageVersion)_$(buildPlatform)_TestSigned.msix"
buildVersion: $(packageVersion)
releaseNotesOption: "input"
releaseNotesInput: "# Testing Setup (Packaged) \n### 1. Install the testing certificate, then install [Amethyst itself](https://install.appcenter.ms/orgs/k2vr/apps/amethyst/distribution_groups/public/releases/latest) \n(Note: The cert import is one-time, no need to redo it each time) \n\n![Certificate](https://imgur.com/M9YUUJA.gif)\n\n### 2. Reregister the driver inside Amethyst\n![Reregister](https://user-images.githubusercontent.com/50022719/230727961-75900c17-e65a-4c87-b653-a90af395d759.gif)"
isMandatory: true
destinationType: "groups"
distributionGroupId: "6753850b-854c-455b-a88f-2b335104a64a"