Skip to content

Commit

Permalink
Tools: Show more info in IOS release script
Browse files Browse the repository at this point in the history
  • Loading branch information
laurent22 committed Nov 7, 2021
1 parent d19551b commit 31ce0f4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/tools/release-ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ async function updateCodeProjVersions(filePath: string) {
const originalContent = await fs.readFile(filePath, 'utf8');
let newContent = originalContent;
let newVersion = '';
let newVersionId = 0;

// MARKETING_VERSION = 10.1.0;
newContent = newContent.replace(/(MARKETING_VERSION = )(\d+\.\d+)\.(\d+)(.*)/g, function(_match, prefix, majorMinorVersion, buildNum, suffix) {
Expand All @@ -24,26 +25,29 @@ async function updateCodeProjVersions(filePath: string) {
newContent = newContent.replace(/(CURRENT_PROJECT_VERSION = )(\d+)(.*)/g, function(_match, prefix, projectVersion, suffix) {
const n = Number(projectVersion);
if (isNaN(n)) throw new Error(`Invalid version code: ${projectVersion}`);
return `${prefix}${n + 1}${suffix}`;
newVersionId = n + 1;
return `${prefix}${newVersionId}${suffix}`;
});

if (!newVersion) throw new Error('Could not determine new version');
if (newContent === originalContent) throw new Error('No change was made to project file');

await fs.writeFile(filePath, newContent, 'utf8');

return newVersion;
return { newVersion, newVersionId };
}

async function main() {
await gitPullTry();

console.info('Updating version numbers...');

const newVersion = await updateCodeProjVersions(`${mobileDir}/ios/Joplin.xcodeproj/project.pbxproj`);
console.info(`New version: ${newVersion}`);
const { newVersion, newVersionId } = await updateCodeProjVersions(`${mobileDir}/ios/Joplin.xcodeproj/project.pbxproj`);
console.info(`New version: ${newVersion} (${newVersionId})`);

const tagName = `ios-v${newVersion}`;
console.info(`Tag name: ${tagName}`);

await execCommand2('git add -A');
await execCommand2(`git commit -m "${tagName}"`);
await execCommand2(`git tag ${tagName}`);
Expand Down

0 comments on commit 31ce0f4

Please sign in to comment.