Skip to content

Publish MSIX to Microsoft Store #2

Publish MSIX to Microsoft Store

Publish MSIX to Microsoft Store #2

name: Publish MSIX to Microsoft Store
on:
# Enable manual run
workflow_dispatch:
# Build & deploy for published releases
release:
types:
- published
concurrency:
group: ci-release-${{ github.ref }}-1
cancel-in-progress: true
env:
msix-filename-prefix: "FeelingFinder"
jobs:
call-build-windows:
uses: ./.github/workflows/build-windows.yml
with:
pre-release: false
secrets: inherit
docker:
needs: call-build-windows
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Setup MSbuild
uses: microsoft/[email protected]
- name: Configure the Microsoft Store CLI
run: |
Install-Module -Name StoreBroker -Force
- name: Publish to Store
env:
CLIENT_ID: ${{ secrets.AZURE_AD_APPLICATION_CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.AZURE_AD_APPLICATION_SECRET }}
run: |
# Login
$user = $Env:CLIENT_ID
$password = ConvertTo-SecureString $Env:CLIENT_SECRET -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential($user, $password)
Set-StoreBrokerAuthentication -TenantId ${{ secrets.AZURE_AD_TENANT_ID }} -Credential $Cred
$appId = ${{ secrets.MICROSOFT_STORE_APP_ID }}
# Get config json
New-StoreBrokerConfigFile -Path .\submission.json -AppId $appId
# Create submission package
# New-SubmissionPackage -ConfigPath .\submission.json -AppxPath .\Tonbrett.msix -OutPath out -OutName package
New-SubmissionPackage -ConfigPath .\submission.json -AppxPath .\artifacts\windows-store-artifact\${{ env.msix-filename-prefix }}-Windows-Store-Installer.msix -OutPath out -OutName package
# Create new submission
$sub = New-ApplicationSubmission -AppId $appId -Force
# Parse submission meta
$json = (Get-Content out\package.json -Encoding UTF8) | ConvertFrom-Json
# Delete old packages
foreach ($package in $sub.applicationPackages) {
$package.fileStatus = "PendingDelete"
}
# add new packages
$sub.applicationPackages += $json.applicationPackages
# Upload submission meta
Set-ApplicationSubmission -AppId $appId -UpdatedSubmission $sub
# Upload submission package
Set-SubmissionPackage -PackagePath out\package.zip -UploadUrl ($sub.fileUploadUrl)
# Commit changes
Complete-ApplicationSubmission -AppId $appId -SubmissionId ($sub.id)