forked from File-New-Project/EarTrumpet
-
Notifications
You must be signed in to change notification settings - Fork 0
474 lines (407 loc) · 22.4 KB
/
main.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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
name: EarTrumpet-CI
on:
push:
branches:
- master
- dev
- rafael/*
- dave/*
- david/*
paths-ignore:
- "**/*.md"
- ".github/ISSUE_TEMPLATE/*"
- ".github/workflows/sponsors.yml"
- ".github/workflows/translators.yml"
- "Graphics/*"
pull_request:
branches:
- dev
paths-ignore:
- "**/*.md"
- crowdin.yml
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
BUILD_CONFIGURATION: Release
BUILD_PLATFORM: x86
ARTIFACTS_BASE: '${{ github.workspace }}\artifacts'
jobs:
build:
runs-on: windows-2019
strategy:
matrix:
channel: [AppInstaller, Store, Chocolatey]
include:
- channel: AppInstaller
publisher:
"CN=File-New-Project, O=File-New-Project, L=Purcellville, S=Virginia, C=US"
- channel: Store
publisher: CN=6099D0EF-9374-47ED-BDFE-A82136831235
- channel: Chocolatey
publisher:
"CN=File-New-Project, O=File-New-Project, L=Purcellville, S=Virginia, C=US"
max-parallel: 3
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Fetch all history for all tags and branches
run: git fetch --prune --unshallow
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: "5.x"
includePrerelease: false
- name: Use GitVersion
id: gitversion
uses: gittools/actions/gitversion/[email protected]
- name: Create artifact layout
shell: powershell
run: |
$ErrorActionPreference = 'Ignore'
New-Item -ItemType Directory "$env:ARTIFACTS_BASE"
New-Item -ItemType Directory "$env:ARTIFACTS_BASE\appxupload"
New-Item -ItemType Directory "$env:ARTIFACTS_BASE\sideload"
New-Item -ItemType Directory "$env:ARTIFACTS_BASE\chocolatey"
New-Item -ItemType Directory "$env:ARTIFACTS_BASE\loose"
New-Item -ItemType Directory "$env:ARTIFACTS_BASE\metadata"
- name: Generate versioning metadata
shell: powershell
run: |
Set-Content "$env:ARTIFACTS_BASE\metadata\semver.txt" "${{ steps.gitversion.outputs.semVer }}"
Set-Content "$env:ARTIFACTS_BASE\metadata\branch.txt" "${{ steps.gitversion.outputs.branchName }}"
Set-Content "$env:ARTIFACTS_BASE\metadata\commits.txt" "${{ steps.gitversion.outputs.commitsSinceVersionSource }}"
if("${{ matrix.channel }}" -eq "Store") {
$Version = "${{ steps.gitversion.outputs.majorMinorPatch }}.0"
} else {
$Version = "${{ steps.gitversion.outputs.majorMinorPatch }}.${{ steps.gitversion.outputs.commitsSinceVersionSource }}"
}
Set-Content "$env:ARTIFACTS_BASE\metadata\${{ matrix.channel }}.version.txt" $Version
- name: Install NuGet
uses: NuGet/setup-nuget@v1
with:
nuget-version: latest
- name: Restore NuGet Packages
run: nuget restore EarTrumpet.vs15.sln
- name: Set Bugsnag API Key
shell: powershell
run: |
$cfg = Get-Content ".\EarTrumpet\app.config"
$cfg | ForEach-Object { $_.Replace("{bugsnag.apikey}", "${{ secrets.bugsnag_api_key }}") } | Set-Content ".\EarTrumpet\app.config"
- name: Adjust manifest and store association
if: matrix.channel == 'Store' || matrix.channel == 'AppInstaller'
shell: powershell
run: |
$manifestPath = ".\EarTrumpet.Package\Package.appxmanifest"
$storeAssociationPath = ".\EarTrumpet.Package\Package.StoreAssociation.xml"
$manifest = [xml](Get-Content $manifestPath)
$manifest.Package.Identity.Publisher = "${{ matrix.publisher }}"
if("${{ matrix.channel }}" -eq "AppInstaller") {
if("${{ steps.gitversion.outputs.branchName }}" -eq "master") {
$manifest.Package.Properties.DisplayName = "EarTrumpet"
$manifest.Package.Applications.Application.VisualElements.DisplayName = "EarTrumpet"
} else {
$manifest.Package.Properties.DisplayName = $manifest.Package.Properties.DisplayName + " (${{ steps.gitversion.outputs.branchName }})"
$manifest.Package.Applications.Application.VisualElements.DisplayName = "EarTrumpet (${{ steps.gitversion.outputs.branchName }})"
}
}
$manifest.Save($manifestPath)
$storeAssociation = [xml](Get-Content $storeAssociationPath)
$storeAssociation.StoreAssociation.Publisher = "${{ matrix.publisher }}"
if("${{ matrix.channel }}" -eq "AppInstaller") {
if("${{ steps.gitversion.outputs.branchName }}" -eq "master") {
$storeAssociation.StoreAssociation.ProductReservedInfo.ReservedNames.ReservedName = "EarTrumpet"
} else {
$storeAssociation.StoreAssociation.ProductReservedInfo.ReservedNames.ReservedName = "EarTrumpet (${{ steps.gitversion.outputs.branchName }})"
}
}
$storeAssociation.Save($storeAssociationPath)
- name: Set up MSBuild
uses: microsoft/setup-msbuild@v1
- name: Build EarTrumpet appxupload package
if: matrix.channel == 'Store'
shell: cmd
run:
msbuild EarTrumpet.Package/EarTrumpet.Package.wapproj
/p:Platform=%BUILD_PLATFORM% /p:Configuration=%BUILD_CONFIGURATION%
/p:AppxBundle=Always /p:Channel=${{ matrix.channel }}
/p:AppxPackageDir=%ARTIFACTS_BASE%\appxupload\
/p:AppxPackageSigningEnabled=false /p:UapAppxPackageBuildMode=CI
-maxcpucount
- name: Upload appxupload artifact
if: matrix.channel == 'Store' && github.event_name != 'pull_request'
uses: actions/upload-artifact@v3
with:
name: appxupload
path: artifacts/appxupload
- name: Build EarTrumpet
if: matrix.channel == 'Chocolatey'
shell: cmd
run:
msbuild EarTrumpet/EarTrumpet.csproj /p:Platform=%BUILD_PLATFORM%
/p:Configuration=%BUILD_CONFIGURATION% /p:Channel=${{ matrix.channel
}} /p:OutputPath=%ARTIFACTS_BASE%\loose\ -maxcpucount
- name: Upload loose artifacts
if:
matrix.channel == 'Chocolatey' && github.event_name != 'pull_request'
uses: actions/upload-artifact@v3
with:
name: loose
path: artifacts/loose
- name: Build EarTrumpet appinstaller/sideload package
if: matrix.channel == 'AppInstaller' || matrix.channel == 'Chocolatey'
shell: cmd
run:
msbuild EarTrumpet.Package/EarTrumpet.Package.wapproj
/p:Platform=%BUILD_PLATFORM% /p:Configuration=%BUILD_CONFIGURATION%
/p:AppxBundle=Always /p:Channel=${{ matrix.channel }}
/p:AppxPackageDir=%ARTIFACTS_BASE%\sideload\
/p:AppxPackageSigningEnabled=false
/p:UapAppxPackageBuildMode=SideloadOnly
/p:GenerateAppInstallerFile=true
/p:AppxPackageTestDir=%ARTIFACTS_BASE%\sideload\
/p:AppInstallerUri="https://install.eartrumpet.app" -maxcpucount
- name: Adjust appinstaller manifest
if:
matrix.channel == 'AppInstaller' && github.event_name !=
'pull_request'
shell: powershell
run: |
$manifestPath = "$env:ARTIFACTS_BASE/sideload/EarTrumpet.Package.appinstaller"
$manifest = [xml](Get-Content $manifestPath)
$manifest.AppInstaller.Uri = "https://install.eartrumpet.app/${{ steps.gitversion.outputs.branchName }}/EarTrumpet.Package.appinstaller"
$manifest.AppInstaller.MainBundle.Uri = "https://install.eartrumpet.app/${{ steps.gitversion.outputs.branchName }}/EarTrumpet.Package_${{ steps.gitversion.outputs.majorMinorPatch }}.${{ steps.gitversion.outputs.commitsSinceVersionSource }}_x86.appxbundle"
$manifest.AppInstaller.MainBundle.Publisher = "${{ matrix.publisher }}"
$fragment = [xml]'<AppInstaller xmlns="http://schemas.microsoft.com/appx/appinstaller/2017/2"><Dependencies><Package Name="Microsoft.VCLibs.140.00.UWPDesktop" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" Version="14.0.30704.0" ProcessorArchitecture="x86" Uri="https://aka.ms/Microsoft.VCLibs.x86.14.00.Desktop.appx" /></Dependencies></AppInstaller>'
$manifest.AppInstaller.InsertAfter($manifest.ImportNode($fragment.AppInstaller.Dependencies, $true), $manifest.AppInstaller.MainBundle)
$manifest.Save($manifestPath)
- name: Upload appinstaller/sideload package artifacts
if:
matrix.channel == 'AppInstaller' && github.event_name !=
'pull_request'
uses: actions/upload-artifact@v3
with:
name: sideload
path: artifacts/sideload
- name: Fix up PDPs
if: matrix.channel == 'Store' && github.event_name != 'pull_request'
shell: pwsh
run: |
Set-Location packaging\MicrosoftStore\PDPs
Get-ChildItem | ForEach-Object {
$locale = $_.Name
$pdp = [xml](Get-Content "$locale\pdp.xml")
$pdp.ProductDescription.language = $locale
$pdp.ProductDescription.lang = $locale
$pdp.ProductDescription
$pdp.Save((Resolve-Path "$locale\pdp.xml"))
}
- name: Stage msix packaging metadata
if: matrix.channel == 'Store' && github.event_name != 'pull_request'
shell: powershell
run: |
Copy-Item packaging\ -Recurse "$env:ARTIFACTS_BASE\metadata\"
- name: Upload metadata artifacts
uses: actions/upload-artifact@v3
with:
name: metadata
path: artifacts/metadata
- name: Stage chocolatey packaging metadata
if:
matrix.channel == 'Chocolatey' && github.event_name != 'pull_request'
shell: powershell
run: |
Copy-Item .chocolatey\* -Recurse "$env:ARTIFACTS_BASE\chocolatey\"
- name: Upload chocolatey artifacts
uses: actions/upload-artifact@v3
with:
name: chocolatey
path: artifacts/chocolatey
release:
needs: build
runs-on: windows-2019
if: github.event_name != 'pull_request'
strategy:
matrix:
channel: [AppInstaller, Store, Chocolatey]
max-parallel: 3
env:
AZURE_TENANT_ID: ${{ secrets.azure_tenant_id }}
AZURE_CLIENT_ID: ${{ secrets.azure_client_id }}
AZURE_CLIENT_SECRET: ${{ secrets.azure_client_secret }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Install NuGet
uses: NuGet/setup-nuget@v1
with:
nuget-version: latest
- name: Install Build Tools
run: nuget install Microsoft.Windows.SDK.BuildTools
- name: Install Azure Codesigning
shell: pwsh
env:
ACS_PACKAGE_URI: ${{ secrets.acs_package_uri }}
ACS_METADATA_URI: ${{ secrets.acs_metadata_uri }}
GITHUB_RUN_ID: ${{ github.run_id }}
run: |
Invoke-WebRequest $env:ACS_PACKAGE_URI -UseBasicParsing -OutFile package.zip
Expand-Archive package.zip -DestinationPath acs
Invoke-WebRequest $env:ACS_METADATA_URI -UseBasicParsing -OutFile acs\metadata.json
- name: Sign and repackage Store artifacts
if: matrix.channel == 'Store'
shell: pwsh
run: |
$MetadataPath = "$env:ARTIFACTS_BASE\metadata"
$Version = [Version](Get-Content "$MetadataPath\Store.version.txt")
$AppxUploadPath = "$env:ARTIFACTS_BASE\AppxUpload"
$BundleFilename = "EarTrumpet.Package_${Version}_x86.appxbundle"
$SymbolsBundleFilename = "EarTrumpet.Package_${Version}_x86.appxsym"
$AppxFilename = "EarTrumpet.Package_${Version}_x86.appx"
$StoreBundleFilename = "EarTrumpet.Package_${Version}_x86_bundle.appxupload"
### Expand bundle and appx package within
$ExtractedPath = "$env:ARTIFACTS_BASE\Extracted"
Expand-Archive "$AppxUploadPath\$StoreBundleFilename" "$ExtractedPath\AppxUpload"
Expand-Archive "$ExtractedPath\AppxUpload\$SymbolsBundleFilename" "$ExtractedPath\Symbols"
Expand-Archive "$ExtractedPath\AppxUpload\$BundleFilename" "$ExtractedPath\Bundle"
Expand-Archive "$ExtractedPath\Bundle\$AppxFilename" "$ExtractedPath\Package"
### Place symbols next to executable image
Copy-Item "$ExtractedPath\Symbols\EarTrumpet.pdb" "$ExtractedPath\Package\EarTrumpet\"
### Sign executable image
& (Resolve-Path "Microsoft.Windows.SDK.BuildTools.*\bin\*\x64\signtool.exe") sign /v /fd SHA256 /td SHA256 /tr http://timestamp.acs.microsoft.com /dlib "acs\bin\x64\Azure.CodeSigning.Dlib.dll" /dmdf "acs\metadata.json" "$ExtractedPath\Package\EarTrumpet\EarTrumpet.exe"
$SignedPath = "$env:ARTIFACTS_BASE\Signed"
New-Item -ItemType Directory "$SignedPath"
New-Item -ItemType Directory "$SignedPath\Package"
New-Item -ItemType Directory "$SignedPath\Bundle"
New-Item -ItemType Directory "$SignedPath\AppxUpload"
### Repackage appx package
& "C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\makeappx.exe" pack /l /h sha256 /d "$ExtractedPath\Package" /o /p "$SignedPath\Package\$AppxFilename"
Set-ItemProperty "$SignedPath\Package\$AppxFilename" -Name IsReadOnly -Value $true
Copy-Item "$ExtractedPath\Bundle\*.appx" "$SignedPath\Package\" -ErrorAction Ignore
Set-ItemProperty "$SignedPath\Package\$AppxFilename" -Name IsReadOnly -Value $false
### Repackage appx bundle
& "C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\makeappx.exe" bundle /d "$SignedPath\Package" /bv $Version /o /p "$SignedPath\Bundle\$BundleFilename"
### Repackage appxupload
Copy-Item "$ExtractedPath\AppxUpload\$SymbolsBundleFilename" "$SignedPath\Bundle"
Compress-Archive -Path "$SignedPath\Bundle\*" -DestinationPath "$SignedPath\AppxUpload\$StoreBundleFilename" -CompressionLevel Optimal
- name: Sign AppInstaller artifacts
if: matrix.channel == 'AppInstaller'
shell: pwsh
run: |
$MetadataPath = "$env:ARTIFACTS_BASE\metadata"
$Version = [Version](Get-Content "$MetadataPath\AppInstaller.version.txt")
$Branch = Get-Content "$MetadataPath\branch.txt"
$Semver= Get-Content "$MetadataPath\semver.txt"
$BundleFilename = "EarTrumpet.Package_${Version}_x86.appxbundle"
$SymbolsBundleFilename = "EarTrumpet.Package_${Version}_x86.appxsym"
$AppxFilename = "EarTrumpet.Package_${Version}_x86.appx"
$SideloadPath = "$env:ARTIFACTS_BASE\sideload"
$SignedPath = "$env:ARTIFACTS_BASE\sideload\signed"
### Expand bundle and appx package within
$ExtractedPath = "$env:TEMP\extracted"
Expand-Archive "$SideloadPath\$SymbolsBundleFilename" "$ExtractedPath\Symbols"
Expand-Archive "$SideloadPath\$BundleFilename" "$ExtractedPath\Bundle"
Write-Output "Expand $ExtractedPath\Bundle\EarTrumpet.Package_${Version}_x86.appx"
Expand-Archive "$ExtractedPath\Bundle\EarTrumpet.Package_${Version}_x86.appx" "$ExtractedPath\Package"
### Place symbols next to executable image
Copy-Item "$ExtractedPath\Symbols\EarTrumpet.pdb" "$ExtractedPath\Package\EarTrumpet\"
### Sign executable image
Write-Output "Signing $ExtractedPath\Package\EarTrumpet\EarTrumpet.exe"
& (Resolve-Path "Microsoft.Windows.SDK.BuildTools.*\bin\*\x64\signtool.exe") sign /v /fd SHA256 /td SHA256 /tr http://timestamp.acs.microsoft.com /dlib "acs\bin\x64\Azure.CodeSigning.Dlib.dll" /dmdf "acs\metadata.json" "$ExtractedPath\Package\EarTrumpet\EarTrumpet.exe"
New-Item -ItemType Directory "$SignedPath"
New-Item -ItemType Directory "$SignedPath\Package"
New-Item -ItemType Directory "$SignedPath\Bundle"
### Repackage appx package
& "C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\makeappx.exe" pack /l /h sha256 /d "$ExtractedPath\Package" /o /p "$SignedPath\Package\$AppxFilename"
Set-ItemProperty "$SignedPath\Package\EarTrumpet.Package_${Version}_x86.appx" -Name IsReadOnly -Value $true
Copy-Item "$ExtractedPath\Bundle\*.appx" "$SignedPath\Package\" -ErrorAction Ignore
Set-ItemProperty "$SignedPath\Package\EarTrumpet.Package_${Version}_x86.appx" -Name IsReadOnly -Value $false
### Repackage appx bundle
& "C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\makeappx.exe" bundle /d "$SignedPath\Package" /bv $Version /o /p "$SignedPath\Bundle\$BundleFilename"
### Sign appx bundle
Write-Output "Signing $SignedPath\Bundle\$BundleFilename"
& (Resolve-Path "Microsoft.Windows.SDK.BuildTools.*\bin\*\x64\signtool.exe") sign /v /fd SHA256 /td SHA256 /tr http://timestamp.acs.microsoft.com /dlib "acs\bin\x64\Azure.CodeSigning.Dlib.dll" /dmdf "acs\metadata.json" "$SignedPath\Bundle\$BundleFilename"
Copy-Item "$SideloadPath\*.appinstaller" "$SignedPath\Bundle"
- name: Sign and repackage Chocolatey artifacts
if: matrix.channel == 'Chocolatey'
shell: pwsh
run: |
$MetadataPath = "$env:ARTIFACTS_BASE\metadata"
$Branch = Get-Content "$MetadataPath\branch.txt"
$Semver= Get-Content "$MetadataPath\semver.txt"
$LooseFilesPath = "$env:ARTIFACTS_BASE\loose"
### Sign executable image
& (Resolve-Path "Microsoft.Windows.SDK.BuildTools.*\bin\*\x64\signtool.exe") sign /v /fd SHA256 /td SHA256 /tr http://timestamp.acs.microsoft.com /dlib "acs\bin\x64\Azure.CodeSigning.Dlib.dll" /dmdf "acs\metadata.json" "$LooseFilesPath\EarTrumpet.exe"
### Package for release
Compress-Archive -Path "$LooseFilesPath\*" -DestinationPath "$env:ARTIFACTS_BASE\chocolatey\tools\release.zip" -CompressionLevel Optimal
- name: Adjust nuspec
if: matrix.channel == 'Chocolatey'
shell: pwsh
run: |
$MetadataPath = "$env:ARTIFACTS_BASE\metadata"
$Version = [Version](Get-Content "$MetadataPath\Chocolatey.version.txt")
$NuspecPath = "$env:ARTIFACTS_BASE\chocolatey\eartrumpet.nuspec"
$nuspec = [xml](Get-Content -Path $NuspecPath)
$nuspec.package.metadata.version = $Version
$nuspec.Save($NuspecPath)
- name: Create chocolatey package
if: matrix.channel == 'Chocolatey'
shell: powershell
run: |
choco pack "$env:ARTIFACTS_BASE\chocolatey\eartrumpet.nuspec" --out "$env:ARTIFACTS_BASE\chocolatey"
- name: Upload chocolatey artifact
if: matrix.channel == 'Chocolatey'
uses: actions/upload-artifact@v3
with:
name: chocolatey-package
path: artifacts/chocolatey/*.nupkg
- name: Install OpenSSH FOD
if: matrix.channel == 'AppInstaller' || matrix.channel == 'Store'
shell: powershell
run: |
Set-Service -Name wuauserv -StartupType Manual
Start-Service -Name wuauserv
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
- name: Prepare for staging
if: matrix.channel == 'AppInstaller' || matrix.channel == 'Store'
shell: powershell
run: |
"${{ secrets.staging_userkey }}" | Out-File -Encoding ascii staging.key | Out-Null
- name: Stage AppInstaller artifacts via SCP
if: matrix.channel == 'AppInstaller'
shell: pwsh
run: |
icacls .\staging.key /inheritance:r
icacls .\staging.key /grant:r "$env:USERNAME`:(R)"
$Branch = Get-Content $env:ARTIFACTS_BASE\metadata\branch.txt
ssh -i staging.key -o "StrictHostKeyChecking no" ${{ secrets.staging_username }}@${{ secrets.staging_host }} "mkdir -p /var/www/html/$Branch"
scp -B -i staging.key -o "StrictHostKeyChecking no" $env:ARTIFACTS_BASE\sideload\signed\bundle\* ${{ secrets.staging_username }}@${{ secrets.staging_host }}:/var/www/html/$Branch
del staging.key
- name: Stage Store artifacts via SCP
if: matrix.channel == 'Store'
shell: pwsh
run: |
icacls .\staging.key /inheritance:r
icacls .\staging.key /grant:r "$env:USERNAME`:(R)"
$Branch = Get-Content $env:ARTIFACTS_BASE\metadata\branch.txt
ssh -i staging.key -o "StrictHostKeyChecking no" ${{ secrets.staging_username }}@${{ secrets.staging_host }} "mkdir -p /var/www/html/store/$Branch"
scp -B -i staging.key -o "StrictHostKeyChecking no" $env:ARTIFACTS_BASE\signed\appxupload\* ${{ secrets.staging_username }}@${{ secrets.staging_host }}:/var/www/html/store/$Branch
del staging.key
- name: Push release to Partner Center via StoreBroker
if: matrix.channel == 'Store'
shell: powershell
run: |
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
Install-Module -Name StoreBroker
$Password = ConvertTo-SecureString '${{ secrets.partnercenter_clientkey }}' -AsPlainText -Force
$Credentials = New-Object System.Management.Automation.PSCredential ('${{ secrets.partnercenter_clientid }}', $Password)
Set-StoreBrokerAuthentication -TenantId '${{ secrets.partnercenter_tenantid }}' -Credential $Credentials -Verbose
$MetadataPath = "$env:ARTIFACTS_BASE\metadata"
$PackagingRoot = "$MetadataPath\Packaging\MicrosoftStore"
$SubmissionRoot = "$env:TEMP\Packaging\Submission"
$Version = [Version](Get-Content "$MetadataPath\Store.version.txt")
$StoreBundleFilename = "EarTrumpet.Package_${Version}_x86_bundle.appxupload"
New-SubmissionPackage -ConfigPath "$PackagingRoot\SBConfig.json" -PDPRootPath "$PackagingRoot\PDPs" -ImagesRootPath "$PackagingRoot\PDPs" -AppxPath "$env:ARTIFACTS_BASE\Signed\AppxUpload\$StoreBundleFilename" -MediaFallbackLanguage en-US -OutPath "$SubmissionRoot" -OutName EarTrumpet -Verbose
$submissionId, $submissionUrl = Update-ApplicationSubmission -AppId "${{ secrets.partnercenter_appid }}" -SubmissionDataPath "$SubmissionRoot\EarTrumpet.json" -PackagePath "$SubmissionRoot\EarTrumpet.zip" -AddPackages -UpdateListings -UpdatePublishModeAndVisibility -UpdatePricingAndAvailability -UpdateAppProperties -UpdateNotesForCertification -TargetPublishMode Manual -Force -Verbose
Complete-ApplicationSubmission -AppId "${{ secrets.partnercenter_appid }}" -SubmissionId $submissionId -Verbose