From 66fea0a1508975e35ff01cfa5dc08ccf33b44008 Mon Sep 17 00:00:00 2001 From: SoftFever <103989404+SoftFever@users.noreply.github.com> Date: Mon, 30 Nov 2026 17:08:54 +0800 Subject: [PATCH] Publish the Microsoft Store package from the release workflow (#18025) Maintainers can tick "msstore_only" when running "Publish to draft release" to send a build's x64 and arm64 MSIX packages to the Microsoft Store as one submission, instead of uploading them in Partner Center by hand. With the option off, the GitHub draft release is published as before. --- .github/workflows/publish_release.yml | 111 +++++++++++++++++++++----- 1 file changed, 90 insertions(+), 21 deletions(-) diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index e5dad5327f..78d06046e4 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -5,6 +5,9 @@ name: Publish to draft release # build first, then publish exactly that run's artifacts once you're happy. # It also writes an ordered download table into the draft's release notes. # +# With "msstore_only" ticked it instead sends that run's MSIX packages to the +# Microsoft Store and leaves the GitHub release alone (see the msstore job). +# # Trigger: Actions tab -> "Publish to draft release" -> Run workflow. # Locked to named publishers: the first step aborts unless the actor is one of the # logins in the `RELEASE_PUBLISHER` repo variable, a comma-separated list. To @@ -19,22 +22,27 @@ on: required: true type: string tag: - description: 'Tag of the draft release to upload to (e.g. v2.4.0-beta)' - required: true + description: 'Tag of the draft release to upload to (e.g. v2.4.0-beta); not needed with msstore_only' + required: false type: string + msstore_only: + description: 'Publish only the MSIX packages to the Microsoft Store, skipping the GitHub draft release' + required: false + type: boolean + default: false permissions: contents: write # upload release assets actions: read # download artifacts from another run +env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RUN_ID: ${{ inputs.run_id }} + jobs: - publish: - name: Publish binaries to draft release + preflight: + name: Check publisher and source build runs-on: ubuntu-latest - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - RUN_ID: ${{ inputs.run_id }} - TAG: ${{ inputs.tag }} steps: - name: Restrict to the release publishers env: @@ -51,18 +59,6 @@ jobs: fi echo "Authorized: @${{ github.actor }}" - - name: Verify target is a draft release - run: | - if ! gh release view "$TAG" --repo "$GITHUB_REPOSITORY" --json isDraft >/dev/null 2>&1; then - echo "::error::Release '$TAG' not found. Create the draft (with this tag) first." - exit 1 - fi - is_draft=$(gh release view "$TAG" --repo "$GITHUB_REPOSITORY" --json isDraft --jq '.isDraft') - if [ "$is_draft" != "true" ]; then - echo "::error::Release '$TAG' is published, not a draft. Aborting to avoid touching a live release." - exit 1 - fi - - name: Verify source build run run: | info=$(gh run view "$RUN_ID" --repo "$GITHUB_REPOSITORY" --json workflowName,conclusion,headBranch) @@ -74,9 +70,33 @@ jobs: echo "::warning::Source run did not conclude 'success' ($conclusion). Some assets may be missing." fi + publish: + name: Publish binaries to draft release + needs: preflight + if: ${{ !inputs.msstore_only }} + runs-on: ubuntu-latest + env: + TAG: ${{ inputs.tag }} + steps: + - name: Verify target is a draft release + run: | + if [ -z "$TAG" ]; then + echo "::error::Set the tag of the draft release to upload to." + exit 1 + fi + if ! gh release view "$TAG" --repo "$GITHUB_REPOSITORY" --json isDraft >/dev/null 2>&1; then + echo "::error::Release '$TAG' not found. Create the draft (with this tag) first." + exit 1 + fi + is_draft=$(gh release view "$TAG" --repo "$GITHUB_REPOSITORY" --json isDraft --jq '.isDraft') + if [ "$is_draft" != "true" ]; then + echo "::error::Release '$TAG' is published, not a draft. Aborting to avoid touching a live release." + exit 1 + fi + - name: Download release artifacts from build run run: | - # Windows_V* (not Windows_*) keeps the MSIX Store artifact out: it goes to Partner Center, not GitHub releases. + # Windows_V* (not Windows_*) keeps the MSIX Store artifact out: the msstore job sends it to the Store, not GitHub releases. gh run download "$RUN_ID" --repo "$GITHUB_REPOSITORY" --dir artifacts \ -p 'OrcaSlicer_Windows_V*' \ -p 'OrcaSlicer_Mac_universal_*' \ @@ -197,3 +217,52 @@ jobs: fi gh release edit "$TAG" --repo "$GITHUB_REPOSITORY" --notes-file notes.new cat table.md + + # The Store gets one bundle holding both architectures: msstore publish starts a + # new submission from the last published one and swaps in only the package of the + # same file type, so the x64 and arm64 packages have to travel together. It + # first deletes any pending submission, and fails if Partner Center refuses to. + # Credentials come from the PARTNER_CENTER_* secrets of the Microsoft Entra app + # linked to the Partner Center account; MSSTORE_PRODUCT_ID is the app's Store ID. + msstore: + name: Publish MSIX to the Microsoft Store + needs: preflight + if: ${{ inputs.msstore_only }} + runs-on: windows-latest + permissions: + actions: read # download artifacts from another run + steps: + - name: Download MSIX packages from build run + run: gh run download $env:RUN_ID --repo $env:GITHUB_REPOSITORY --dir artifacts -p 'OrcaSlicer_Windows_MSIX_*' + + - name: Bundle the packages + run: | + $packages = Get-ChildItem artifacts -Recurse -Filter *.msix + foreach ($arch in 'x64', 'arm64') { + if (-not ($packages | Where-Object Name -like "*_$arch.msix")) { + throw "The $arch MSIX package is missing from run $env:RUN_ID." + } + } + New-Item -ItemType Directory bundle_in | Out-Null + $packages | Copy-Item -Destination bundle_in + $makeappx = Get-ChildItem "${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.*\x64\makeappx.exe" | + Sort-Object { [version]$_.Directory.Parent.Name } -Descending | + Select-Object -First 1 -ExpandProperty FullName + & $makeappx bundle /d bundle_in /p OrcaSlicer.msixbundle /o + if ($LASTEXITCODE -ne 0) { throw "makeappx bundle failed with exit code $LASTEXITCODE" } + + - name: Install the Microsoft Store CLI + uses: microsoft/microsoft-store-apppublisher@v1.4 + + - name: Publish the bundle to the Microsoft Store + env: + TENANT_ID: ${{ secrets.PARTNER_CENTER_TENANT_ID }} + SELLER_ID: ${{ secrets.PARTNER_CENTER_SELLER_ID }} + CLIENT_ID: ${{ secrets.PARTNER_CENTER_CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.PARTNER_CENTER_CLIENT_SECRET }} + PRODUCT_ID: ${{ vars.MSSTORE_PRODUCT_ID }} + run: | + if (-not $env:PRODUCT_ID) { throw "MSSTORE_PRODUCT_ID repo variable is not set." } + $PSNativeCommandUseErrorActionPreference = $true + msstore reconfigure --tenantId $env:TENANT_ID --sellerId $env:SELLER_ID --clientId $env:CLIENT_ID --clientSecret $env:CLIENT_SECRET + msstore publish OrcaSlicer.msixbundle -id $env:PRODUCT_ID