|
| 1 | +# Copyright (c) 2024 Files Community |
| 2 | +# Licensed under the MIT License. See the LICENSE. |
| 3 | + |
| 4 | +param( |
| 5 | + [string]$SubmissionDirPath = "", |
| 6 | + [string]$StoreBrokerConfigPath = "", |
| 7 | + [string]$AppxPackagePath = "", |
| 8 | + [string]$PartnerCenterClientId = "", |
| 9 | + [string]$PartnerCenterClientSecret = "", |
| 10 | + [string]$PartnerCenterStoreId = "", |
| 11 | + [string]$PartnerCenterTenantId = "" |
| 12 | +) |
| 13 | + |
| 14 | +# Setup |
| 15 | +Set-ExecutionPolicy RemoteSigned -Force |
| 16 | +Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted |
| 17 | +Install-Module -Name StoreBroker |
| 18 | + |
| 19 | +# Authenticate StoreBroker |
| 20 | +$UserName = $PartnerCenterClientId |
| 21 | +$Password = ConvertTo-SecureString $PartnerCenterClientSecret |
| 22 | +$Credential = New-Object System.Management.Automation.PSCredential ($UserName, $Password) |
| 23 | +Set-StoreBrokerAuthentication -TenantId $PartnerCenterTenantId -Credential $Credential |
| 24 | + |
| 25 | +# Prepare the submission package |
| 26 | +New-SubmissionPackage -ConfigPath $StoreBrokerConfigPath -AppxPath $AppxPackagePath -OutPath $SubmissionDirPath -OutName 'submission' |
| 27 | +$SubmissionDataPath = Join-Path -Path $SubmissionDirPath -ChildPath 'submission.json' |
| 28 | +$SubmissionPackagePath = Join-Path -Path $SubmissionDirPath -ChildPath 'submission.zip' |
| 29 | + |
| 30 | +# Upload the package |
| 31 | +Update-ApplicationSubmission -Verbose -ReplacePackages -AppId $PartnerCenterStoreId -SubmissionDataPath $SubmissionDataPath -PackagePath $SubmissionPackagePath -AutoCommit -Force -NoStatus |
0 commit comments