diff --git a/scripts/release/verify-bundle-version.js b/scripts/release/verify-bundle-version.js index 605d6b2f..54876a8b 100755 --- a/scripts/release/verify-bundle-version.js +++ b/scripts/release/verify-bundle-version.js @@ -99,6 +99,17 @@ function listBundleFiles(bundleTypeDir, extensions) { .map((entry) => path.join(bundleTypeDir, entry)); } +function readMacOSAppBundleVersion(appPath) { + const plistPath = path.join(appPath, 'Contents', 'Info.plist'); + try { + const content = fs.readFileSync(plistPath, 'utf8'); + const match = content.match(/CFBundleShortVersionString<\/key>\s*([^<]+)<\/string>/); + return match ? match[1].trim() : null; + } catch { + return null; + } +} + function verifyBundleVersion({ targetDir, profile, expectedVersion, platform, bundles }) { const normalizedPlatform = normalizePlatform(platform); const bundleTypes = resolveBundleTypes({ bundles, platform: normalizedPlatform }); @@ -135,6 +146,22 @@ function verifyBundleVersion({ targetDir, profile, expectedVersion, platform, bu continue; } + // macOS .app bundles don't include version in filename — check Info.plist + if (bundleType === 'app') { + for (const filePath of files) { + const plistVersion = readMacOSAppBundleVersion(filePath); + if (plistVersion && plistVersion === expectedVersion) { + continue; + } + if (!plistVersion) { + errors.push(`Could not read version from ${path.basename(filePath)}/Contents/Info.plist`); + } else if (plistVersion !== expectedVersion) { + errors.push(`${path.basename(filePath)} has version ${plistVersion}, expected ${expectedVersion}`); + } + } + continue; + } + const matchedFiles = files.filter((filePath) => path.basename(filePath).includes(expectedVersion)); const staleFiles = files.filter((filePath) => !path.basename(filePath).includes(expectedVersion));