Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions scripts/release/verify-bundle-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(/<key>CFBundleShortVersionString<\/key>\s*<string>([^<]+)<\/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 });
Expand Down Expand Up @@ -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));

Expand Down
Loading