apple build/upload: accept --allow-version-mismatch (flag list regenerated); 1.0 and 1.0.0 are one version train

This commit is contained in:
CRTkafa 2026-10-23 09:57:13 +08:00
parent ebd64e0f76
commit c7bae75ed0
4 changed files with 20 additions and 2 deletions

View file

@ -177,7 +177,9 @@ export function ipaInfo(ipa: string | Buffer): IpaInfo {
* that ignores the version storebound or the release script intends exports MARKETING_VERSION 1.0), else null.
* `wanted` is the --version of apple build or the editable App Store version; `source` names where it comes from. Pure. */
export function ipaVersionProblem(ipaVersion: string, wanted: string | null | undefined, source: string): string | null {
if (!wanted || ipaVersion === wanted) return null;
// Apple compares version strings numerically with missing parts as 0: 1.0 and 1.0.0 are the same train
const norm = (v: string) => v.trim().split('.').map(n => String(Number(n))).join('.').replace(/(\.0)+$/, '');
if (!wanted || norm(ipaVersion) === norm(wanted)) return null;
return `the IPA has version ${ipaVersion} (CFBundleShortVersionString), but ${source} is ${wanted}: the Xcode project sets MARKETING_VERSION itself, so the build lands in the wrong version train. Make the project read the intended version (xcodebuild MARKETING_VERSION=${wanted}, or set it in the project / Info.plist), build again, or pass --allow-version-mismatch to go on anyway.`;
}