mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-11-28 16:58:41 +01:00
Windows CI: Store step last, UTF-8, off by default; keep the Store price
Run 45656293842 failed in "Submit to Microsoft Store": the changelog bullets went through cp1252 on the Windows runner, and the failure skipped the Windows zip and symbols uploads. The step now runs last with PYTHONUTF8=1. The v1 submission API cannot save a submission for an app on the advanced pricing model: priceId "Base" is rejected, and without it the price is reset to Free. The script now sends pricing without priceId and aborts (deleting its submission) when the saved pricing differs, so it can't publish a free BikeControl. msstore_submit defaults to off until the API can keep the price; packages go through Partner Center meanwhile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
50
.github/workflows/build.yml
vendored
50
.github/workflows/build.yml
vendored
@@ -34,9 +34,9 @@ on:
|
||||
default: true
|
||||
type: boolean
|
||||
msstore_submit:
|
||||
description: 'Windows: submit the MSIX + release notes to the Microsoft Store for certification'
|
||||
description: 'Windows: submit the MSIX + release notes to the Microsoft Store (fails while the app uses the advanced Base price, see scripts/msstore_submission.py)'
|
||||
required: false
|
||||
default: true
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
env:
|
||||
@@ -351,28 +351,6 @@ jobs:
|
||||
name: BikeControl Store
|
||||
path: build/windows/x64/runner/Release/bike_control.store.msix
|
||||
|
||||
# Partner Center submission API (scripts/msstore_submission.py): a copy of
|
||||
# the last published submission with the new MSIX and the Windows release
|
||||
# notes (entries about other platforms left out, 1500-char Store limit),
|
||||
# committed for certification. Credentials: Entra app "uploadmsix" in the
|
||||
# openbikecontrol.onmicrosoft.com tenant, Manager role in Partner Center.
|
||||
- name: Submit to Microsoft Store
|
||||
if: inputs.msstore_submit
|
||||
shell: bash
|
||||
env:
|
||||
MSSTORE_TENANT_ID: ${{ secrets.AZURE_AD_TENANT_ID }}
|
||||
MSSTORE_CLIENT_ID: ${{ secrets.AZURE_AD_APPLICATION_CLIENT_ID }}
|
||||
MSSTORE_CLIENT_SECRET: ${{ secrets.AZURE_AD_APPLICATION_SECRET }}
|
||||
run: |
|
||||
# get_latest_changelog.sh runs python3; the Windows image only has python.
|
||||
command -v python3 >/dev/null || cp "$(command -v python)" "$(dirname "$(command -v python)")/python3.exe"
|
||||
mkdir -p store_notes
|
||||
./scripts/get_latest_changelog.sh en --windows | ./scripts/truncate_release_notes.sh 1500 > store_notes/msstore.txt
|
||||
cat store_notes/msstore.txt
|
||||
python scripts/msstore_submission.py \
|
||||
--msix build/windows/x64/runner/Release/bike_control.store.msix \
|
||||
--release-notes store_notes/msstore.txt
|
||||
|
||||
- name: Upload Windows artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@@ -403,6 +381,30 @@ jobs:
|
||||
tag: v${{ env.VERSION }}
|
||||
token: ${{ github.token }}
|
||||
|
||||
# Partner Center submission API (scripts/msstore_submission.py): a copy of
|
||||
# the last published submission with the new MSIX and the Windows release
|
||||
# notes (entries about other platforms left out, 1500-char Store limit),
|
||||
# committed for certification. Credentials: Entra app "uploadmsix" in the
|
||||
# openbikecontrol.onmicrosoft.com tenant, Manager role in Partner Center.
|
||||
- name: Submit to Microsoft Store
|
||||
if: inputs.msstore_submit
|
||||
shell: bash
|
||||
env:
|
||||
# The changelog bullets are UTF-8; Windows Python defaults to cp1252.
|
||||
PYTHONUTF8: "1"
|
||||
MSSTORE_TENANT_ID: ${{ secrets.AZURE_AD_TENANT_ID }}
|
||||
MSSTORE_CLIENT_ID: ${{ secrets.AZURE_AD_APPLICATION_CLIENT_ID }}
|
||||
MSSTORE_CLIENT_SECRET: ${{ secrets.AZURE_AD_APPLICATION_SECRET }}
|
||||
run: |
|
||||
# get_latest_changelog.sh runs python3; the Windows image only has python.
|
||||
command -v python3 >/dev/null || cp "$(command -v python)" "$(dirname "$(command -v python)")/python3.exe"
|
||||
mkdir -p store_notes
|
||||
./scripts/get_latest_changelog.sh en --windows | ./scripts/truncate_release_notes.sh 1500 > store_notes/msstore.txt
|
||||
cat store_notes/msstore.txt
|
||||
python scripts/msstore_submission.py \
|
||||
--msix build/windows/x64/runner/Release/bike_control.store.msix \
|
||||
--release-notes store_notes/msstore.txt
|
||||
|
||||
linux:
|
||||
if: inputs.build_linux
|
||||
name: Build on Linux (${{ matrix.arch }})
|
||||
|
||||
@@ -19,6 +19,12 @@ replaces what was passed, uploads the files and commits it for certification:
|
||||
--dry-run reads the last published submission and prints what would
|
||||
change; creates nothing.
|
||||
|
||||
Limitation: with Partner Center's advanced pricing model (BikeControl: base
|
||||
price "Base" + 7-day trial) the v1 API cannot save a submission without
|
||||
resetting the price to Free; the script detects that and deletes its
|
||||
submission before committing. Until the API supports it, submit packages
|
||||
through Partner Center (Start update -> Packages -> upload -> Save -> Submit).
|
||||
|
||||
Credentials (an Entra ID app with the Manager role in Partner Center, here
|
||||
"uploadmsix" in the openbikecontrol.onmicrosoft.com tenant) come from
|
||||
MSSTORE_TENANT_ID, MSSTORE_CLIENT_ID and MSSTORE_CLIENT_SECRET.
|
||||
@@ -91,6 +97,23 @@ def screenshot_files(directory: Path) -> list[Path]:
|
||||
return files
|
||||
|
||||
|
||||
def update_body(submission: dict) -> dict:
|
||||
"""The submission as the update (PUT) takes it. With the advanced pricing
|
||||
model the copy reports the price as priceId "Base", which the update
|
||||
rejects ("'Base' is not a valid PriceId"), while leaving pricing out is
|
||||
rejected too. So pricing goes back without priceId; the price stays as it
|
||||
is in Partner Center (checked after the update, see [same_pricing])."""
|
||||
body = dict(submission)
|
||||
pricing = body.get("pricing", {})
|
||||
if pricing.get("priceId") == "Base":
|
||||
body["pricing"] = {k: v for k, v in pricing.items() if k != "priceId"}
|
||||
return body
|
||||
|
||||
|
||||
def same_pricing(before: dict, after: dict) -> bool:
|
||||
return before.get("pricing") == after.get("pricing")
|
||||
|
||||
|
||||
def summary(submission: dict) -> list[str]:
|
||||
"""What the submission adds and removes, for logs and --dry-run."""
|
||||
lines = []
|
||||
@@ -207,7 +230,10 @@ def main(argv: list[str] | None = None) -> int:
|
||||
z.writestr(name, data)
|
||||
upload_zip(submission["fileUploadUrl"], buffer.getvalue())
|
||||
print(f"uploaded {len(files)} file(s), {buffer.tell() // 1024} KB")
|
||||
store.call("PUT", f"/submissions/{submission_id}", submission)
|
||||
store.call("PUT", f"/submissions/{submission_id}", update_body(submission))
|
||||
saved = store.call("GET", f"/submissions/{submission_id}")
|
||||
if not same_pricing(submission, saved):
|
||||
raise RuntimeError(f"pricing changed by the update: {submission.get('pricing')} -> {saved.get('pricing')}")
|
||||
store.call("POST", f"/submissions/{submission_id}/commit")
|
||||
except Exception:
|
||||
print(f"failed; deleting submission {submission_id} so the next run can start clean", file=sys.stderr)
|
||||
|
||||
@@ -71,5 +71,19 @@ class MsStoreSubmissionTest(unittest.TestCase):
|
||||
self.assertIn("package PendingDelete: old.msix 7.6.2.0", lines)
|
||||
|
||||
|
||||
def test_update_leaves_out_the_advanced_base_price_only(self):
|
||||
s = submission()
|
||||
s["pricing"] = {"priceId": "Base", "isAdvancedPricingModel": True, "trialPeriod": "SevenDays"}
|
||||
self.assertEqual(ms.update_body(s)["pricing"], {"isAdvancedPricingModel": True, "trialPeriod": "SevenDays"})
|
||||
self.assertIn("pricing", s, "the submission itself keeps it for the check")
|
||||
s["pricing"] = {"priceId": "Tier5"}
|
||||
self.assertEqual(ms.update_body(s)["pricing"], {"priceId": "Tier5"})
|
||||
|
||||
def test_pricing_check(self):
|
||||
p = {"priceId": "Base", "trialPeriod": "SevenDays"}
|
||||
self.assertTrue(ms.same_pricing({"pricing": p}, {"pricing": dict(p)}))
|
||||
self.assertFalse(ms.same_pricing({"pricing": p}, {"pricing": {"priceId": "Free"}}))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user