play-publish-changes: a release is ready only when the store page shows an older version; unknown reads are not determined, never a mismatch
This commit is contained in:
parent
4e2ffd6b3d
commit
26f9559e1a
6 changed files with 40 additions and 15 deletions
|
|
@ -13,9 +13,23 @@ export const PUBLISH_CONFIRM = 'Publish';
|
|||
|
||||
export interface ReadyChange { track: string; version: string | null; build: string | null; rollout: string; liveVersion: string | null }
|
||||
|
||||
/**
|
||||
* Ready only when the public store page POSITIVELY shows an older version than the completed production release
|
||||
* (both parsed and compared; playReleases sets liveVersion only then) and the page read is fresh. A 404, a failed or
|
||||
* stale read, "Varies with device", a same or newer version, or an unparseable version is never "ready": a release
|
||||
* already published (managed publishing, "Last published on ...") must not be reported as waiting.
|
||||
*/
|
||||
const isReady = (r: ReturnType<typeof playReleases>[number]): boolean => r.track === 'production' && r.managed === true && r.phase === 'review' && !!r.liveVersion && !r.pageStaleAt && !!r.version;
|
||||
|
||||
/** True when a completed managed production release exists but the store page cannot tell whether it is published. */
|
||||
export function readyUndetermined(data: unknown): boolean {
|
||||
const rs = playReleases(data);
|
||||
return (data as { managedPublishing?: unknown })?.managedPublishing === true && rs.some(r => r.track === 'production' && r.state === 'completed' && !isReady(r) && r.phase !== 'live');
|
||||
}
|
||||
|
||||
/** Ready-to-publish production releases from the `play status --json` data ({ tracks, publicPage, managedPublishing }). */
|
||||
export function readyToPublish(data: unknown): ReadyChange[] {
|
||||
return playReleases(data).filter(r => r.track === 'production' && r.managed === true && r.phase === 'review').map(r => ({
|
||||
return playReleases(data).filter(isReady).map(r => ({
|
||||
track: r.track ?? 'production', version: r.version, build: r.build,
|
||||
rollout: r.fraction !== null && r.fraction < 1 ? `${Math.round(r.fraction * 1000) / 10}% staged` : 'full rollout', liveVersion: r.liveVersion ?? null,
|
||||
}));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue