From 4cfc5b63cb4c44157e0233368d661d9f02bebbb9 Mon Sep 17 00:00:00 2001 From: Guruprasad Kulkarni Date: Thu, 26 Nov 2026 01:47:30 +0100 Subject: [PATCH 1/2] feat(ios): the App Store listing can create the version being prepared --- .claude/skills/smt/SKILL.md | 2 +- .github/workflows/app-store-listing.yml | 8 ++++- tool/app_store.mjs | 41 +++++++++++++++++++------ tool/app_store.test.mjs | 34 ++++++++++++++++++++ 4 files changed, 73 insertions(+), 12 deletions(-) diff --git a/.claude/skills/smt/SKILL.md b/.claude/skills/smt/SKILL.md index 6c9feaa..730f515 100644 --- a/.claude/skills/smt/SKILL.md +++ b/.claude/skills/smt/SKILL.md @@ -183,7 +183,7 @@ Tagging, promoting, submitting for App Review and pushing the listings reach rea - A rerun of a tag run uses the workflow file as it was at the tag. A workflow fix needs a new tag. - Widget and integration tests: put `pumpAndSettle` between `ensureVisible` and `tap`. The scroll pins the End header (a setState), so the control moves one frame later. - Do not push to a pull request while a merge-on-green job waits for it: it restarts every check. The GraphQL rate limit (and its secondary limit) is shared by every agent and polling loop; poll with REST (`gh api repos/.../commits//check-runs`) and merge with `gh api -X PUT repos/comdotlinux/simple-math-tester/pulls//merge -f merge_method=squash`. In zsh, `for p in $list` does not split on spaces; use an array or literal words. -- App Store screenshots: the required slots are iPhone 6.3" (1206x2622) and iPad 13" (2048x2732); iPhone 6.9" (1290x2796) is optional. Apple copies them to each new version, so a release needs no new shoot. `app-store-listing.yml` takes about 45 minutes with screenshots; if only the upload fails, rerun with `-f screenshots-from-run=` (artifacts last 7 days), or `-f screenshots=false` for texts only. +- App Store screenshots: the required slots are iPhone 6.3" (1206x2622) and iPad 13" (2048x2732); iPhone 6.9" (1290x2796) is optional. Apple copies them to each new version, so a release needs no new shoot. `app-store-listing.yml` takes about 45 minutes with screenshots; if only the upload fails, rerun with `-f screenshots-from-run=` (artifacts last 7 days), or `-f screenshots=false` for texts only. With no version in preparation (after a release went live) it stops; add `-f version=X.Y.Z` to create that version first. - No bundled font has U+25A1 or U+2192. The blank (a line on the baseline) and the arrow are drawn widgets; tests fail if those characters reach a `RichText` or a semantics label. ## 9. Before saying a task is done diff --git a/.github/workflows/app-store-listing.yml b/.github/workflows/app-store-listing.yml index f9c492e..cc616f0 100644 --- a/.github/workflows/app-store-listing.yml +++ b/.github/workflows/app-store-listing.yml @@ -19,6 +19,11 @@ on: required: false type: string default: '' + version: + description: 'Version to create (e.g. 1.5.0) when none is in preparation in App Store Connect' + required: false + type: string + default: '' permissions: contents: read @@ -186,7 +191,8 @@ jobs: APPSTORE_KEY_ID: ${{ secrets.APPSTORE_KEY_ID }} APPSTORE_ISSUER_ID: ${{ secrets.APPSTORE_ISSUER_ID }} SCREENSHOTS: ${{ inputs.screenshots }} + VERSION: ${{ inputs.version }} run: | dir= if [ "$SCREENSHOTS" = true ]; then dir="$RUNNER_TEMP/app-store-screenshots"; fi - node tool/app_store.mjs listing ${dir:+"$dir"} + node tool/app_store.mjs listing ${dir:+"$dir"} ${VERSION:+--version "$VERSION"} diff --git a/tool/app_store.mjs b/tool/app_store.mjs index c41e208..9f6f665 100644 --- a/tool/app_store.mjs +++ b/tool/app_store.mjs @@ -231,20 +231,36 @@ async function appRecord(api) { return app; } -/** The app, its editable app info and the App Store version being prepared. */ -export async function findApp(api) { +/** + * The app, its editable app info and the App Store version being prepared. + * With [newVersion] (e.g. "1.5.0"), creates that version when none is being + * prepared; App Store Connect then opens a new editable app info too. + */ +export async function findApp(api, newVersion) { const app = await appRecord(api); + const versions = async () => + (await api('GET', `/v1/apps/${app.id}/appStoreVersions?filter[platform]=IOS&limit=10`)).data; + let version = pickEditable(await versions()); + if (!version && newVersion) { + console.log(`Creating App Store version ${newVersion}`); + version = ( + await api('POST', '/v1/appStoreVersions', { + type: 'appStoreVersions', + attributes: { platform: 'IOS', versionString: newVersion }, + relationships: { app: { data: { type: 'apps', id: app.id } } }, + }) + ).data; + } const info = pickEditable((await api('GET', `/v1/apps/${app.id}/appInfos`)).data); - const version = pickEditable( - (await api('GET', `/v1/apps/${app.id}/appStoreVersions?filter[platform]=IOS&limit=10`)).data, - ); - if (!info || !version) throw new Error('No App Store version in preparation: create one in App Store Connect first'); + if (!info || !version) { + throw new Error('No App Store version in preparation: run with a version, or create one in App Store Connect'); + } return { app, info, version }; } /** Writes every listing (and with [screenshots], the screenshots) to App Store Connect. */ -export async function listing(api, screenshots) { - const { info, version } = await findApp(api); +export async function listing(api, screenshots, newVersion) { + const { info, version } = await findApp(api, newVersion); console.log(`Version ${version.attributes.versionString}`); const byLocale = (body) => Object.fromEntries(body.data.map((l) => [l.attributes.locale, l])); const infoLocalizations = byLocale(await api('GET', `/v1/appInfos/${info.id}/appInfoLocalizations?limit=200`)); @@ -412,7 +428,12 @@ export async function review(api, versionString, notes, dryRun) { async function main() { const [command, ...args] = process.argv.slice(2); - if (command === 'listing') return listing(connect(process.env), args[0]); + if (command === 'listing') { + const at = args.indexOf('--version'); + const newVersion = at >= 0 ? args[at + 1] : undefined; + const [dir] = args.filter((a, i) => i !== at && i !== at + 1); + return listing(connect(process.env), dir, newVersion); + } if (command === 'devices' && devices[args[0]]) { const { size, ratio, pixels } = devices[args[0]]; return console.log(`SCREENSHOT_SIZE=${size}\nSCREENSHOT_PIXEL_RATIO=${ratio}\nSCREENSHOT_PIXELS=${pixels}`); @@ -423,7 +444,7 @@ async function main() { return review(connect(process.env), args[0], notes, args.includes('--dry-run')); } throw new Error( - 'Usage: node tool/app_store.mjs listing [screenshots dir] | devices | review [notes.json] [--dry-run]', + 'Usage: node tool/app_store.mjs listing [screenshots dir] [--version X.Y.Z] | devices | review [notes.json] [--dry-run]', ); } diff --git a/tool/app_store.test.mjs b/tool/app_store.test.mjs index 6d34a4a..55f271f 100644 --- a/tool/app_store.test.mjs +++ b/tool/app_store.test.mjs @@ -11,6 +11,7 @@ import { appStoreTexts, connect, devices, + findApp, listing, pickEditable, replaceScreenshots, @@ -234,6 +235,39 @@ test('the listing updates a version localization that appeared after it was read assert.ok(calls.includes('PATCH /v1/appStoreVersionLocalizations/ver-de')); }); +test('with a version, the listing creates it when none is in preparation', async () => { + const calls = []; + let created = false; + const api = async (method, path, data) => { + calls.push(`${method} ${path}`); + if (path.startsWith('/v1/apps?')) return { data: [{ id: 'app' }] }; + if (path.startsWith('/v1/apps/app/appStoreVersions')) { + return { data: [{ id: 'old', attributes: { versionString: '1.4.2', appVersionState: 'READY_FOR_DISTRIBUTION' } }] }; + } + if (method === 'POST' && path === '/v1/appStoreVersions') { + created = true; + assert.deepEqual(data.attributes, { platform: 'IOS', versionString: '1.5.0' }); + return { data: { id: 'new', attributes: { versionString: '1.5.0', appVersionState: 'PREPARE_FOR_SUBMISSION' } } }; + } + // The editable app info appears with the new version. + if (path === '/v1/apps/app/appInfos') { + return { data: [{ id: 'info', attributes: { state: created ? 'PREPARE_FOR_SUBMISSION' : 'READY_FOR_DISTRIBUTION' } }] }; + } + throw new Error(`unexpected ${method} ${path}`); + }; + const log = console.log; + console.log = () => {}; + try { + await assert.rejects(findApp(api), /No App Store version in preparation/); + assert.ok(!calls.includes('POST /v1/appStoreVersions')); + const { info, version } = await findApp(api, '1.5.0'); + assert.equal(version.id, 'new'); + assert.equal(info.id, 'info'); + } finally { + console.log = log; + } +}); + test('the screenshot sets are the required iPhone medium size, iPhone large and iPad 13"', () => { assert.deepEqual(Object.fromEntries(Object.entries(devices).map(([device, d]) => [device, d.displayType])), { iphone: 'APP_IPHONE_61', From 1de8d11dfccb6ca0ffd6a02b3e4628919046590b Mon Sep 17 00:00:00 2001 From: Guruprasad Kulkarni Date: Thu, 26 Nov 2026 02:09:01 +0100 Subject: [PATCH 2/2] style: format the App Store listing test --- tool/app_store.test.mjs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tool/app_store.test.mjs b/tool/app_store.test.mjs index 55f271f..78634ce 100644 --- a/tool/app_store.test.mjs +++ b/tool/app_store.test.mjs @@ -242,7 +242,9 @@ test('with a version, the listing creates it when none is in preparation', async calls.push(`${method} ${path}`); if (path.startsWith('/v1/apps?')) return { data: [{ id: 'app' }] }; if (path.startsWith('/v1/apps/app/appStoreVersions')) { - return { data: [{ id: 'old', attributes: { versionString: '1.4.2', appVersionState: 'READY_FOR_DISTRIBUTION' } }] }; + return { + data: [{ id: 'old', attributes: { versionString: '1.4.2', appVersionState: 'READY_FOR_DISTRIBUTION' } }], + }; } if (method === 'POST' && path === '/v1/appStoreVersions') { created = true; @@ -251,7 +253,9 @@ test('with a version, the listing creates it when none is in preparation', async } // The editable app info appears with the new version. if (path === '/v1/apps/app/appInfos') { - return { data: [{ id: 'info', attributes: { state: created ? 'PREPARE_FOR_SUBMISSION' : 'READY_FOR_DISTRIBUTION' } }] }; + return { + data: [{ id: 'info', attributes: { state: created ? 'PREPARE_FOR_SUBMISSION' : 'READY_FOR_DISTRIBUTION' } }], + }; } throw new Error(`unexpected ${method} ${path}`); };