Package for Microsoft Store #15
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish to Microsoft Store | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Package version to publish (example: 2.1.0 or 2.1.0.0)' | |
| required: true | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: publish-to-store | |
| cancel-in-progress: false | |
| env: | |
| DOTNET_VERSION: 10.0.x | |
| CONFIGURATION: Release | |
| STORE_APP_ID: ${{ secrets.STORE_APP_ID }} | |
| PROJECT_PATH: ./src/uno/AzureKeyVaultStudio/AzureKeyVaultStudio.csproj | |
| jobs: | |
| publish_to_partner_center: | |
| name: Publish MSIX bundle to Partner Center | |
| runs-on: windows-latest | |
| timeout-minutes: 45 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Configure Microsoft Store CLI | |
| uses: microsoft/microsoft-store-apppublisher@b76227f539d68e6465f79bbbc82ed92f61081aa4 | |
| - name: Reconfigure Store credentials | |
| shell: pwsh | |
| run: | | |
| msstore reconfigure ` | |
| --tenantId ${{ secrets.AZURE_AD_TENANT_ID }} ` | |
| --sellerId ${{ secrets.SELLER_ID }} ` | |
| --clientId ${{ secrets.AZURE_AD_APPLICATION_CLIENT_ID }} ` | |
| --clientSecret ${{ secrets.AZURE_AD_APPLICATION_SECRET }} | |
| - name: Validate version | |
| id: version | |
| shell: pwsh | |
| run: | | |
| $versionInput = '${{ github.event.inputs.version }}' | |
| $version = ($versionInput -replace '^v', '').Trim() | |
| if ($version -notmatch '^\d+(?:\.\d+){2,3}$') { | |
| throw "Version '$versionInput' is not in the expected format. Examples: 2.1.0 or 2.1.0.0." | |
| } | |
| $parts = $version.Split('.') | |
| if ($parts.Length -eq 3) { | |
| $version = "$($parts[0]).$($parts[1]).$($parts[2]).0" | |
| } | |
| echo "value=$version" >> $env:GITHUB_OUTPUT | |
| - name: Build MSIX packages for all platforms | |
| shell: pwsh | |
| run: | | |
| $version = '${{ steps.version.outputs.value }}' | |
| $packageRoot = Join-Path $env:GITHUB_WORKSPACE 'artifacts/store-bundle' | |
| New-Item -ItemType Directory -Force -Path $packageRoot | Out-Null | |
| foreach ($platform in @('x64', 'x86', 'arm64')) { | |
| $platformDir = Join-Path $packageRoot $platform | |
| New-Item -ItemType Directory -Force -Path $platformDir | Out-Null | |
| dotnet msbuild "${{ env.PROJECT_PATH }}" ` | |
| /restore ` | |
| /t:Build ` | |
| /p:Configuration=Release ` | |
| /p:TargetFramework=net10.0-windows10.0.26100 ` | |
| /p:WindowsPackageType=MSIX ` | |
| /p:GenerateAppxPackageOnBuild=true ` | |
| /p:UapAppxPackageBuildMode=StoreUpload ` | |
| /p:AppxBundle=Never ` | |
| /p:Platform=$platform ` | |
| /p:AppxPackageSigningEnabled=false ` | |
| /p:AppxPackageDir="$platformDir\" ` | |
| /p:SelfContained=true ` | |
| /p:PublishReadyToRun=true ` | |
| /p:PublishTrimmed=false ` | |
| /p:Version=$version ` | |
| /p:AppxManifestIdentityVersion=$version | |
| if ($LASTEXITCODE -ne 0) { | |
| throw "Build failed for platform '$platform' (exit code $LASTEXITCODE)" | |
| } | |
| } | |
| - name: Collect MSIX files | |
| id: packages | |
| shell: pwsh | |
| run: | | |
| $packageRoot = Join-Path $env:GITHUB_WORKSPACE 'artifacts/store-bundle' | |
| $msixFiles = Get-ChildItem -Path $packageRoot -Recurse -File -Filter *.msix -ErrorAction SilentlyContinue | | |
| Sort-Object FullName | |
| if (-not $msixFiles) { | |
| throw "No .msix files were found under $packageRoot" | |
| } | |
| Write-Host "Found $($msixFiles.Count) MSIX files:" | |
| $msixFiles | ForEach-Object { Write-Host " - $($_.FullName)" } | |
| $packagesJson = ($msixFiles | ForEach-Object { | |
| @{ fileName = $_.FullName; contentType = 'MSIX' } | |
| } | ConvertTo-Json -AsArray -Compress) | |
| echo "json=$packagesJson" >> $env:GITHUB_OUTPUT | |
| Write-Host "Packages JSON: $packagesJson" | |
| Write-Host "Uploading packages to existing Store draft submission" | |
| msstore submission get ${{ env.STORE_APP_ID }} | |
| msstore submission update ${{ env.STORE_APP_ID }} "{\"packages\": $packagesJson }" | |
| if ($LASTEXITCODE -ne 0) { | |
| throw "msstore submission update failed with exit code $LASTEXITCODE" | |
| } | |
| - name: Upload package artifacts | |
| if: always() | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a | |
| with: | |
| name: store-package | |
| path: | | |
| artifacts/** | |