WIP from the MacBook: apple platform helper for submit, resubmit, release and status
This commit is contained in:
parent
3e4015b686
commit
96c1074701
8 changed files with 169 additions and 57 deletions
|
|
@ -7,7 +7,9 @@
|
|||
// A submission back from App Review (UNRESOLVED_ISSUES) is shown with its items; resubmit it with
|
||||
// storebound apple resubmit --build <n>
|
||||
// Wait for App Review (polls with backoff: 1 min, x1.5, max 15 min):
|
||||
// storebound apple status --wait-review [--version 1.2.0] [--timeout 48h]
|
||||
// storebound apple status --wait-review [--version 1.2.0] [--platform ios|macos] [--timeout 48h]
|
||||
// Every version and review submission line names its platform (iOS, macOS, tvOS, visionOS): one app record holds them
|
||||
// all, and a rejected macOS version must not read like the iOS one.
|
||||
// exit codes: 0 approved, 1 rejected, 7 timeout (2 = nothing in review)
|
||||
// Also compares the App ID's capabilities, apple.signing.capabilities and the iOS project's entitlements and warns,
|
||||
// naming what is missing where.
|
||||
|
|
@ -23,20 +25,24 @@ import { type Asc, ascClient, type J } from './asc';
|
|||
import { notCancellable, readItems, type SubItem } from './submission';
|
||||
import { capabilityReport, type CapabilityReport, printCapabilityReport } from './signing';
|
||||
import * as rt from '../lib/rt';
|
||||
import { type ApplePlatform, parsePlatform, platformName, platformOf, platformSlug } from '../lib/apple-platform';
|
||||
|
||||
async function waitReview(ctx: Ctx, c: Asc, appId: string): Promise<never> {
|
||||
const want = ctx.args.get('version');
|
||||
// every platform unless --platform: a macOS version in review is waited for like an iOS one
|
||||
const platform = parsePlatform(ctx.args.get('platform'));
|
||||
const deadline = Date.now() + parseDuration(ctx.args.str('timeout', '48h'));
|
||||
const state = (v: J): string => v.attributes.appVersionState ?? v.attributes.appStoreState;
|
||||
let delay: number | null = null;
|
||||
let last = '';
|
||||
for (;;) {
|
||||
const vs = await c.all(`/v1/apps/${appId}/appStoreVersions?filter[platform]=IOS&limit=10`);
|
||||
const v = want ? vs.find(x => x.attributes.versionString === want) : vs.find(x => classifyReviewState(state(x)) === 'pending') ?? vs[0];
|
||||
if (!v) { log('apple', `no version ${want ?? ''} found`); process.exit(2); }
|
||||
const vs = await c.all(`/v1/apps/${appId}/appStoreVersions?${platform ? `filter[platform]=${platform}&` : ''}limit=10`);
|
||||
const pending = (x: J): boolean => classifyReviewState(state(x)) === 'pending';
|
||||
const v = want ? vs.find(x => x.attributes.versionString === want && pending(x)) ?? vs.find(x => x.attributes.versionString === want) : vs.find(pending) ?? vs[0];
|
||||
if (!v) { log('apple', `no version ${want ?? ''} found${platform ? ` on ${platformName(platform)}` : ''}`); process.exit(2); }
|
||||
const st = state(v);
|
||||
const outcome = classifyReviewState(st);
|
||||
if (st !== last) { log('apple', `${v.attributes.versionString}: ${st}`); last = st; }
|
||||
if (st !== last) { log('apple', `${v.attributes.versionString} (${platformName(platformOf(v))}): ${st}`); last = st; }
|
||||
if (outcome === 'approved') { log('apple', 'approved (release it yourself, or it goes out automatically if the release type says so)'); process.exit(WAIT_EXIT.approved); }
|
||||
if (outcome === 'rejected') { log('apple', `rejected: read the message in ${consoleLink('asc.app-review')}, then the review-rejections skill`); process.exit(WAIT_EXIT.rejected); }
|
||||
if (outcome === 'not-submitted') { log('apple', 'nothing is waiting for review'); process.exit(2); }
|
||||
|
|
@ -77,8 +83,8 @@ export async function run(ctx: Ctx): Promise<void> {
|
|||
let caps: CapabilityReport | { error: string };
|
||||
try { caps = await capabilityReport(c, config, root); } catch (e) { caps = { error: (e as Error).message.slice(0, 300) }; }
|
||||
// a submission back from App Review: its items and their states, and how to resubmit it
|
||||
const unresolved: { id: string; items: SubItem[] }[] = [];
|
||||
for (const s of subs.filter((x: J) => x.attributes?.state === 'UNRESOLVED_ISSUES')) unresolved.push({ id: s.id, items: await readItems(c, s.id) });
|
||||
const unresolved: { id: string; platform: ApplePlatform; items: SubItem[] }[] = [];
|
||||
for (const s of subs.filter((x: J) => x.attributes?.state === 'UNRESOLVED_ISSUES')) unresolved.push({ id: s.id, platform: platformOf(s), items: await readItems(c, s.id) });
|
||||
// an empty draft: App Store Connect keeps it and refuses to cancel it; harmless
|
||||
const empty = new Set<string>();
|
||||
for (const s of subs.filter((x: J) => x.attributes?.state === 'READY_FOR_REVIEW')) if (!(await readItems(c, s.id)).length) empty.add(s.id);
|
||||
|
|
@ -89,7 +95,7 @@ export async function run(ctx: Ctx): Promise<void> {
|
|||
try { gaps = await firstProductReport(c, appId, { iaps, versionState: reviewed ? vstate(reviewed) : undefined }); } catch (e) { log('apple', `first in-app purchases not compared with the review: ${(e as Error).message.slice(0, 200)}`); }
|
||||
const itemLabel = (kind: string, id: string): string => {
|
||||
const v = versions.find((x: J) => x.id === id);
|
||||
return v ? `app version ${v.attributes.versionString}` : `${kind} ${id}`;
|
||||
return v ? `${platformName(platformOf(v))} app version ${v.attributes.versionString}` : `${kind} ${id}`;
|
||||
};
|
||||
if (ctx.args.has('json')) {
|
||||
// phased release of the newest versions that are live or close to it (rollout share on the desktop timeline)
|
||||
|
|
@ -115,16 +121,17 @@ export async function run(ctx: Ctx): Promise<void> {
|
|||
}
|
||||
|
||||
console.log(`${app.attributes.name} · ${app.attributes.bundleId} · Apple ID ${appId}`);
|
||||
for (const v of versions) console.log(` version ${v.attributes.versionString.padEnd(8)} ${v.attributes.appVersionState ?? v.attributes.appStoreState}${v.relationships?.build?.data ? ' (build attached)' : ''}`);
|
||||
// one app record holds iOS, macOS, tvOS and visionOS versions: every line names its platform
|
||||
for (const v of versions) console.log(` version ${String(v.attributes.versionString).padEnd(8)} ${platformName(platformOf(v)).padEnd(8)} ${v.attributes.appVersionState ?? v.attributes.appStoreState}${v.relationships?.build?.data ? ' (build attached)' : ''}`);
|
||||
const pre = new Map((builds.included ?? []).map((p: { id: string; attributes: { version: string } }) => [p.id, p.attributes.version]));
|
||||
for (const b of builds.data) console.log(` build ${String(pre.get(b.relationships?.preReleaseVersion?.data?.id) ?? '?')} (${b.attributes.version}) ${b.attributes.processingState} ${b.attributes.uploadedDate?.slice(0, 10) ?? ''}`);
|
||||
for (const p of iaps) console.log(` iap ${p.attributes.productId.padEnd(40)} ${p.attributes.inAppPurchaseType} ${p.attributes.state}`);
|
||||
for (const s of subs) console.log(` review submission ${s.id} ${s.attributes.state}${empty.has(s.id) ? `: ${EMPTY_DRAFT}` : ''} ${s.attributes.submittedDate?.slice(0, 10) ?? ''}`.trimEnd());
|
||||
for (const s of subs) console.log(` review submission ${s.id} ${platformName(platformOf(s))} ${s.attributes.state}${empty.has(s.id) ? `: ${EMPTY_DRAFT}` : ''} ${s.attributes.submittedDate?.slice(0, 10) ?? ''}`.trimEnd());
|
||||
for (const u of unresolved) {
|
||||
console.log(` review submission ${u.id} is back from App Review with UNRESOLVED_ISSUES; its items:`);
|
||||
console.log(` review submission ${u.id} (${platformName(u.platform)}) is back from App Review with UNRESOLVED_ISSUES; its items:`);
|
||||
for (const it of u.items) console.log(` ${itemLabel(it.kind, it.versionId).padEnd(36)} ${it.state}${it.state === 'REJECTED' ? ' (not resolved: Apple takes no resubmit until it is; apple resubmit marks it resolved)' : ''}`);
|
||||
const newest = builds.data[0]?.attributes?.version;
|
||||
console.log(` resubmit with: storebound apple resubmit --build <n>${newest ? ` (newest uploaded build: ${newest})` : ''}`);
|
||||
console.log(` resubmit with: storebound apple resubmit --build <n>${u.platform === 'IOS' ? '' : ` --platform ${platformSlug(u.platform)}`}${newest ? ` (newest uploaded build: ${newest})` : ''}`);
|
||||
}
|
||||
for (const g of gaps) warn('apple', `${g.msg}; ${g.fix}`);
|
||||
if ('error' in caps) log('apple', `capabilities not compared: ${caps.error}`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue