The swiss army knife of lossless video/audio editing
storeRelease: fixes from final review
Mikael Finstad1e77ce296731
diff --git a/.github/workflows/store-release.yml b/.github/workflows/store-release.ymlindex 53cccc29..b9195147 100644--- a/.github/workflows/store-release.yml+++ b/.github/workflows/store-release.yml@@ -22,6 +22,9 @@ on:concurrency: store-release+permissions:+ contents: read+jobs:store-release:if: github.repository == 'mifi/lossless-cut'diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex b10226be..4019d016 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -136,6 +136,7 @@ What the script does:- **Mac App Store**: App Store versions have their own numbering (1.x, e.g. 1.14), separate from the GitHub/build version (`package.json`, e.g. 3.70.1), which is the build attached to it. The script takes the build version, and creates the next App Store version (1.14 → 1.15) or reuses the editable one. It waits for the build to finish processing and attaches it, sets en-US "What's New", manual release, 7-day phased release, and submits for review.- **Microsoft Store**: creates a submission, replaces the packages with both `.appx` files from the GitHub release (renamed without `-DONT-USE-THIS-FILE`), sets en-US "What's new", gradual rollout at 0%, "Don't publish until I select Publish now", and submits for certification. Don't edit a submission in Partner Center that the script created, or the API can no longer change it.- If the version is already submitted or released, it says so and does nothing.+- It stops before changing anything when a store isn't ready for a new version: Mac App Store while another version is in review or waiting to be released, Microsoft Store while another submission is pending or the previous gradual rollout hasn't finished (finalize it with `msstore-rollout 100`, or halt it).- Description, keywords and screenshots are not touched; update them by hand if needed.If it fails, use the manual steps below.diff --git a/script/storeRelease.ts b/script/storeRelease.tsindex df1359de..ac1b504d 100644--- a/script/storeRelease.ts+++ b/script/storeRelease.ts@@ -82,7 +82,7 @@ async function readNotes(version: string, maxLength: number) {const ascBase = 'https://api.appstoreconnect.apple.com';const ascRoleHint = 'The API key needs the "App Manager" (or "Admin") role. Create one in App Store Connect → Users and Access → Integrations → App Store Connect API → Team Keys.';-interface AscResource { id: string, type: string, attributes: Record<string, unknown> }+interface AscResource { id: string, type: string, attributes: Record<string, unknown>, relationships?: Record<string, { data?: { id: string } | null }> }let ascKey: ReturnType<typeof createPrivateKey> | undefined;@@ -135,7 +135,7 @@ async function mas(version: string) {log(`Build ${version} is already in App Store version ${attachedTo.attributes['versionString']} (${attachedTo.attributes['appVersionState']}), nothing to do`);return;}- const inFlight = versions.find((v) => ['WAITING_FOR_REVIEW', 'IN_REVIEW', 'ACCEPTED', 'PENDING_DEVELOPER_RELEASE', 'PENDING_APPLE_RELEASE', 'PROCESSING_FOR_DISTRIBUTION'].includes(String(v.attributes['appVersionState'])));+ const inFlight = versions.find((v) => ['WAITING_FOR_REVIEW', 'WAITING_FOR_EXPORT_COMPLIANCE', 'IN_REVIEW', 'ACCEPTED', 'PENDING_DEVELOPER_RELEASE', 'PENDING_APPLE_RELEASE', 'PROCESSING_FOR_DISTRIBUTION'].includes(String(v.attributes['appVersionState'])));assert(editable || !inFlight, `App Store version ${inFlight?.attributes['versionString']} is ${inFlight?.attributes['appVersionState']}; release it (or remove it from review) before creating a new version`);const [major, minor] = String(versions[0]!.attributes['versionString']).split('.').map(Number);const versionString = editable ? String(editable.attributes['versionString']) : `${major}.${minor! + 1}`;@@ -201,9 +201,12 @@ async function mas(version: string) {// Reuse an unsubmitted or rejected submission (left by an earlier run or App Review), only one can be openconst [openSubmission] = (await asc<AscResource[]>('GET', `/v1/reviewSubmissions?filter[app]=${masAppId}&filter[platform]=MAC_OS&filter[state]=READY_FOR_REVIEW,UNRESOLVED_ISSUES`))!;const submission = openSubmission ?? (await asc('POST', '/v1/reviewSubmissions', { type: 'reviewSubmissions', attributes: { platform: 'MAC_OS' }, relationships: { app: ref('apps', masAppId) } }))!;- const items = openSubmission ? await asc<AscResource[]>('GET', `/v1/reviewSubmissions/${submission.id}/items`) : [];- if (items?.length === 0) {+ const items = openSubmission ? (await asc<AscResource[]>('GET', `/v1/reviewSubmissions/${submission.id}/items?include=appStoreVersion`))! : [];+ const item = items.find((i) => i.relationships?.['appStoreVersion']?.data?.id === versionId);+ if (!item) {await asc('POST', '/v1/reviewSubmissionItems', { type: 'reviewSubmissionItems', relationships: { reviewSubmission: ref('reviewSubmissions', submission.id), appStoreVersion: ref('appStoreVersions', versionId) } });+ } else if (item.attributes['state'] === 'REJECTED') {+ await asc('PATCH', `/v1/reviewSubmissionItems/${item.id}`, { type: 'reviewSubmissionItems', id: item.id, attributes: { resolved: true } });}const submitted = await asc('PATCH', `/v1/reviewSubmissions/${submission.id}`, { type: 'reviewSubmissions', id: submission.id, attributes: { submitted: true } });log(`Submitted for review: ${submitted?.attributes['state']}`);