diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7e7c216..b2239a7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,6 +9,8 @@ jobs: runs-on: windows-latest permissions: contents: write + outputs: + version: ${{ steps.version.outputs.version }} steps: - name: Checkout code @@ -105,6 +107,8 @@ jobs: name: msix-${{ steps.version.outputs.version }} path: Symlinker/bin/msix/*.msixbundle if-no-files-found: error + # The store job uses it right away; a big unsigned bundle needn't stay for 90 days. + retention-days: 30 - name: Build ClickOnce package (unsigned) shell: pwsh @@ -134,4 +138,66 @@ jobs: - name: Deploy signed ClickOnce to gh-pages shell: pwsh - run: ./release.ps1 -SignedArtifactDir "signed-clickonce" \ No newline at end of file + run: ./release.ps1 -SignedArtifactDir "signed-clickonce" + + store: + name: Publish to Microsoft Store + needs: release + # Off until the repository variable STORE_AUTO_PUBLISH is 'true'. Turn it on once the first + # submission is published: the Store CLI can't make a first submission, and a submission still + # in certification blocks a new one. + if: vars.STORE_AUTO_PUBLISH == 'true' + runs-on: windows-latest + permissions: + contents: read + env: + STORE_APP_ID: 9P8H93Z0TGK4 + VERSION: ${{ needs.release.outputs.version }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download MSIX bundle + uses: actions/download-artifact@v4 + with: + name: msix-${{ env.VERSION }} + path: msix + + - name: Set up Microsoft Store CLI + uses: microsoft/microsoft-store-apppublisher@v1.4 + with: + version: v0.4.4 + + - name: Sign in to Partner Center + shell: pwsh + env: + STORE_TENANT_ID: ${{ secrets.STORE_TENANT_ID }} + STORE_SELLER_ID: ${{ secrets.STORE_SELLER_ID }} + STORE_CLIENT_ID: ${{ secrets.STORE_CLIENT_ID }} + STORE_CLIENT_SECRET: ${{ secrets.STORE_CLIENT_SECRET }} + run: | + msstore reconfigure --tenantId $env:STORE_TENANT_ID --sellerId $env:STORE_SELLER_ID ` + --clientId $env:STORE_CLIENT_ID --clientSecret $env:STORE_CLIENT_SECRET + if ($LASTEXITCODE -ne 0) { throw "msstore reconfigure failed ($LASTEXITCODE)." } + + # Makes a new draft from the last published submission (listings, screenshots and options + # carry over) and replaces its package with this bundle. + - name: Upload bundle to a draft submission + shell: pwsh + run: | + $bundle = Get-ChildItem msix -Filter *.msixbundle | Select-Object -First 1 + if (-not $bundle) { throw "No .msixbundle in the msix-$env:VERSION artifact." } + msstore publish $bundle.FullName --appId $env:STORE_APP_ID --noCommit --uploadTimeout 3600 + if ($LASTEXITCODE -ne 0) { throw "msstore publish failed ($LASTEXITCODE)." } + + - name: Set What's new from listings.json + shell: pwsh + run: ./packaging/msix/store/set-release-notes.ps1 -Version $env:VERSION -ProductId $env:STORE_APP_ID + + - name: Submit for certification + shell: pwsh + run: | + msstore submission publish $env:STORE_APP_ID + if ($LASTEXITCODE -ne 0) { throw "msstore submission publish failed ($LASTEXITCODE)." } + msstore submission status $env:STORE_APP_ID \ No newline at end of file diff --git a/CLAUDE.md b/CLAUDE.md index 62c1330..03c761e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -167,6 +167,9 @@ Releases are automated via GitHub Actions: 1. Push a Git tag: `git tag v1.2.3 && git push origin v1.2.3` 2. [.github/workflows/release.yml](.github/workflows/release.yml) runs `release.ps1` on a Windows runner 3. The app is published to `gh-pages` and ClickOnce auto-updates existing installs +4. The `store` job submits the MSIX bundle to the Microsoft Store, when the repository variable `STORE_AUTO_PUBLISH` is `true`. It uses the Store CLI with the `STORE_TENANT_ID`, `STORE_CLIENT_ID`, `STORE_CLIENT_SECRET` and `STORE_SELLER_ID` secrets, copies the last published submission, swaps in the new bundle, sets "What's new" from `packaging/msix/store/listings.json` and submits it for certification. + +Before tagging, update `ReleaseNotes` in `listings.json` for every language and set `common.ReleaseNotesVersion` to the new version. If it doesn't match the tag, the job clears "What's new" instead of showing old notes. Wait for the previous Store submission to finish certification first: one still in progress blocks a new one. ## Known Limitations diff --git a/packaging/msix/store/README.md b/packaging/msix/store/README.md index 9bfd0ec..9e9c743 100644 --- a/packaging/msix/store/README.md +++ b/packaging/msix/store/README.md @@ -8,10 +8,25 @@ Everything Partner Center needs besides the package. Store ID `9P8H93Z0TGK4`. - `listing-template.csv`: the empty template from Partner Center > Store listings > Export listings. The script fills it in. - `ScreenshotTool/`: renders the real main window in each language at 2.5x, with a headline, on a 1920x1080 image. - `make-listings.ps1`: builds the screenshots and the CSV files into `Symlinker/bin/store-listing`. +- `set-release-notes.ps1`: sets "What's new" on the draft Store submission from `listings.json`. The release workflow runs it. + +## Releasing to the Store + +Once the repository variable `STORE_AUTO_PUBLISH` is `true`, pushing a `v*` tag publishes to the Store (the `store` job in `release.yml`): + +1. `msstore publish --noCommit` makes a draft from the last published submission and swaps in the new bundle. Listings, screenshots, pricing and options carry over. +2. `set-release-notes.ps1` sets "What's new" in every language from `listings.json`, but only when `common.ReleaseNotesVersion` matches the tag. Otherwise it clears "What's new" and the job shows a warning. +3. `msstore submission publish` sends it to certification. Partner Center emails the result. + +So before tagging, write the new `ReleaseNotes` in every language and set `ReleaseNotesVersion`. Don't tag while an earlier submission is still in certification. + +To set "What's new" on a draft by hand: `msstore reconfigure ...`, then `./packaging/msix/store/set-release-notes.ps1 -Version `. ## Updating the listing -1. Edit `listings.json`. Every submission needs new "What's new" text (`ReleaseNotes`) in every language. +Text other than "What's new", and screenshots, only change by hand: + +1. Edit `listings.json`. 2. Run `./packaging/msix/store/make-listings.ps1`. 3. In Partner Center, open the submission, then Store listings > Import listings > Upload .csv and pick `listingData-text-only.csv`. 4. Screenshots stay from the last submission. To replace them, upload `/store1-3.png` on each language's listing page. diff --git a/packaging/msix/store/listings.json b/packaging/msix/store/listings.json index 0ffb6eb..1f25b11 100644 --- a/packaging/msix/store/listings.json +++ b/packaging/msix/store/listings.json @@ -1,5 +1,6 @@ { "common": { + "ReleaseNotesVersion": "4.3.0", "Title": "Symlinker - Symlink Creator", "DevStudio": "Alejandro Mora", "CopyrightTrademarkInformation": "© 2026 Alejandro Mora", diff --git a/packaging/msix/store/set-release-notes.ps1 b/packaging/msix/store/set-release-notes.ps1 new file mode 100644 index 0000000..13c8d80 --- /dev/null +++ b/packaging/msix/store/set-release-notes.ps1 @@ -0,0 +1,87 @@ +<# +.SYNOPSIS +Sets "What's new" on the draft Store submission from listings.json, in every language. + +.DESCRIPTION +Run after `msstore publish --noCommit` has made the draft. Reads the draft with +`msstore submission get`, sets each listing's release notes and sends it back with +`msstore submission update`. + +listings.json's common.ReleaseNotesVersion says which version the notes were written for. When it +doesn't match -Version, the notes would describe an older release, so they are cleared instead and +a warning is printed. + +.EXAMPLE +./packaging/msix/store/set-release-notes.ps1 -Version 4.3.0 +#> +[CmdletBinding()] +param( + [Parameter(Mandatory)][string]$Version, + [string]$ProductId = '9P8H93Z0TGK4', + # For testing: read and write this file instead of calling msstore. + [string]$SubmissionFile +) + +$ErrorActionPreference = 'Stop' +$data = Get-Content (Join-Path $PSScriptRoot 'listings.json') -Raw -Encoding UTF8 | ConvertFrom-Json + +# Finds a JSON property ignoring case: the Store API's casing isn't documented consistently. +function Get-Property([System.Text.Json.Nodes.JsonObject]$node, [string]$name) { + foreach ($pair in $node) { + if ($pair.Key -ieq $name) { return $pair } + } + return $null +} + +function Set-ReleaseNotes([string]$submissionJson) { + $current = $data.common.ReleaseNotesVersion -eq $Version + if (-not $current) { + Write-Host "::warning::listings.json has release notes for $($data.common.ReleaseNotesVersion), not $Version. Clearing What's new on the Store." + } + + $submission = [System.Text.Json.Nodes.JsonNode]::Parse($submissionJson).AsObject() + $listings = Get-Property $submission 'listings' + if (-not $listings) { throw 'The submission has no listings.' } + + foreach ($listing in @($listings.Value.AsObject())) { + $language = $listing.Key + $base = Get-Property $listing.Value.AsObject() 'baseListing' + if (-not $base) { throw "The $language listing has no baseListing." } + + $entry = $data.PSObject.Properties | Where-Object { $_.Name -ieq $language } | Select-Object -First 1 + if (-not $entry) { Write-Host "::warning::listings.json has no $language listing. Leaving it as is."; continue } + + $notes = if ($current) { [string]$entry.Value.ReleaseNotes } else { '' } + $field = Get-Property $base.Value.AsObject() 'releaseNotes' + $key = if ($field) { $field.Key } else { 'releaseNotes' } + $base.Value.AsObject()[$key] = [System.Text.Json.Nodes.JsonValue]::Create($notes) + Write-Host "What's new set for $language ($($notes.Length) characters)." + } + return $submission.ToJsonString() +} + +if ($SubmissionFile) { + $updated = Set-ReleaseNotes (Get-Content $SubmissionFile -Raw -Encoding UTF8) + [IO.File]::WriteAllText($SubmissionFile, $updated) + return +} + +$output = (msstore submission get $ProductId) -join "`n" +if ($LASTEXITCODE -ne 0) { throw "msstore submission get failed ($LASTEXITCODE)." } +# Keep only the JSON, in case the CLI prints a notice before it. +$start = $output.IndexOf('{') +$end = $output.LastIndexOf('}') +if ($start -lt 0 -or $end -lt $start) { throw "msstore submission get returned no JSON: $output" } +$json = $output.Substring($start, $end - $start + 1) +$updated = Set-ReleaseNotes $json + +# A file, not an argument: the whole submission is longer than a command line allows. +$file = Join-Path ([IO.Path]::GetTempPath()) "store-submission-$ProductId.json" +[IO.File]::WriteAllText($file, $updated) +try { + msstore submission update $ProductId $file | Out-Null + if ($LASTEXITCODE -ne 0) { throw "msstore submission update failed ($LASTEXITCODE)." } +} +finally { + Remove-Item $file -ErrorAction SilentlyContinue +}