Ship-step contract for pipelines: uniform exit codes (0/1/2/3/4/7) in cli/lib/ship-step.ts, one final --json line, --result-file (atomic, also on failure), --progress json, --env-file with secret redaction, --version-from; idempotent play upload / apple upload / play release / apple submit re-runs end with exit 7; play upload takes --track production and --version-code
This commit is contained in:
parent
4eac8e8cd8
commit
06a0b424f5
14 changed files with 928 additions and 24 deletions
|
|
@ -29,6 +29,7 @@ import { playClient } from './client';
|
|||
import { readPlayCopy, refusePlayNotes } from './listing';
|
||||
import { usedVersionCodes } from './next-version-code';
|
||||
import * as rt from '../lib/rt';
|
||||
import { shipPhase } from '../lib/ship-step';
|
||||
|
||||
const TAG = 'build';
|
||||
|
||||
|
|
@ -97,12 +98,14 @@ export async function run(ctx: Ctx): Promise<void> {
|
|||
if (!sdk.path) throw new Error(androidSdkMissing(sdk));
|
||||
notesGuard(ctx);
|
||||
log(TAG, `Android SDK: ${sdk.path} (from ${sdk.source})`);
|
||||
shipPhase('prebuild', 'web build / prebuild');
|
||||
const web = await webStep({ ...webOpts, dry: false });
|
||||
if (signing && !existsSync(signing.storeFile)) throw new Error('ANDROID_KEYSTORE: the keystore file does not exist');
|
||||
if (!signing) warn(TAG, 'no ANDROID_KEYSTORE: the project\'s own release signingConfig must sign, else Play refuses the bundle');
|
||||
for (const n of t.notes) log(TAG, n);
|
||||
for (const w of versionWarnings) warn(TAG, w);
|
||||
log(TAG, `$ ${plan.command}`);
|
||||
shipPhase('build', `${plan.task}, versionCode ${code || '?'}`);
|
||||
const started = Date.now();
|
||||
mkdirSync(out, { recursive: true });
|
||||
const p = rt.spawn(argv, { cwd, stdout: 'pipe', stderr: 'pipe', env: { ...process.env, ...androidSdkEnv(sdk), ...signingEnv(signing) } });
|
||||
|
|
@ -118,9 +121,11 @@ export async function run(ctx: Ctx): Promise<void> {
|
|||
if (exit !== 0) throw new Error(`build failed (exit ${exit}); last lines:\n${lines.slice(-20).join('\n')}\nfull log: ${relative(root, logFile)}`);
|
||||
const aab = findBundles([join(t.dir, t.module, 'build', 'outputs', 'bundle'), join(root, 'build', 'app', 'outputs', 'bundle')], started - 1000)[0];
|
||||
if (!aab) throw new Error(`build finished but no new .aab under ${relative(root, t.dir)}/${t.module}/build/outputs/bundle`);
|
||||
shipPhase('sign', 'checking the bundle signature');
|
||||
const info = aabInfo(aab);
|
||||
// Play refuses an unsigned bundle (403) only at upload: stop here, naming the fix
|
||||
assertAabSigned(aab, relative(root, aab));
|
||||
shipPhase('verify', `versionCode ${info.versionCode}, ${info.packageName}`);
|
||||
if (info.packageName !== pkg) warn(TAG, `the AAB's package is ${info.packageName}, the config says ${pkg}`);
|
||||
// the hard stop: an AAB with another versionCode than planned is never copied to the output folder
|
||||
if (code && info.versionCode !== code) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue