mirror of https://github.com/laurent22/joplin.git
Tools: IOS release script
parent
e673ce132e
commit
f24f8e8b47
|
@ -8,8 +8,8 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"bootstrap": "lerna bootstrap --no-ci",
|
"bootstrap": "lerna bootstrap --no-ci",
|
||||||
"bootstrapServerOnly": "lerna bootstrap --no-ci --include-dependents --include-dependencies --scope @joplin/server",
|
|
||||||
"bootstrapIgnoreScripts": "lerna bootstrap --ignore-scripts --no-ci",
|
"bootstrapIgnoreScripts": "lerna bootstrap --ignore-scripts --no-ci",
|
||||||
|
"bootstrapServerOnly": "lerna bootstrap --no-ci --include-dependents --include-dependencies --scope @joplin/server",
|
||||||
"build": "lerna run build && npm run tsc",
|
"build": "lerna run build && npm run tsc",
|
||||||
"buildApiDoc": "npm start --prefix=packages/app-cli -- apidoc ../../readme/api/references/rest_api.md",
|
"buildApiDoc": "npm start --prefix=packages/app-cli -- apidoc ../../readme/api/references/rest_api.md",
|
||||||
"buildDoc": "./packages/tools/build-all.sh",
|
"buildDoc": "./packages/tools/build-all.sh",
|
||||||
|
@ -18,8 +18,8 @@
|
||||||
"buildTranslationsNoTsc": "node packages/tools/build-translation.js",
|
"buildTranslationsNoTsc": "node packages/tools/build-translation.js",
|
||||||
"buildWebsite": "npm run buildApiDoc && node ./packages/tools/build-website.js && npm run buildPluginDoc",
|
"buildWebsite": "npm run buildApiDoc && node ./packages/tools/build-website.js && npm run buildPluginDoc",
|
||||||
"circularDependencyCheck": "madge --warning --circular --extensions js ./",
|
"circularDependencyCheck": "madge --warning --circular --extensions js ./",
|
||||||
"dependencyTree": "madge",
|
|
||||||
"clean": "lerna clean -y && lerna run clean",
|
"clean": "lerna clean -y && lerna run clean",
|
||||||
|
"dependencyTree": "madge",
|
||||||
"generateDatabaseTypes": "node packages/tools/generate-database-types",
|
"generateDatabaseTypes": "node packages/tools/generate-database-types",
|
||||||
"linkChecker": "linkchecker https://joplinapp.org",
|
"linkChecker": "linkchecker https://joplinapp.org",
|
||||||
"linter-ci": "./node_modules/.bin/eslint --resolve-plugins-relative-to . --quiet --ext .js --ext .jsx --ext .ts --ext .tsx",
|
"linter-ci": "./node_modules/.bin/eslint --resolve-plugins-relative-to . --quiet --ext .js --ext .jsx --ext .ts --ext .tsx",
|
||||||
|
@ -27,11 +27,12 @@
|
||||||
"linter": "./node_modules/.bin/eslint --resolve-plugins-relative-to . --fix --quiet --ext .js --ext .jsx --ext .ts --ext .tsx",
|
"linter": "./node_modules/.bin/eslint --resolve-plugins-relative-to . --fix --quiet --ext .js --ext .jsx --ext .ts --ext .tsx",
|
||||||
"postinstall": "npm run bootstrap --no-ci && npm run build",
|
"postinstall": "npm run bootstrap --no-ci && npm run build",
|
||||||
"publishAll": "git pull && npm run build && lerna version --yes --no-private --no-git-tag-version && gulp completePublishAll",
|
"publishAll": "git pull && npm run build && lerna version --yes --no-private --no-git-tag-version && gulp completePublishAll",
|
||||||
"releaseAndroidClean": "node packages/tools/release-android.js",
|
|
||||||
"releaseAndroid": "export PATH=\"/usr/local/opt/openjdk@11/bin:$PATH\" && node packages/tools/release-android.js",
|
"releaseAndroid": "export PATH=\"/usr/local/opt/openjdk@11/bin:$PATH\" && node packages/tools/release-android.js",
|
||||||
|
"releaseAndroidClean": "node packages/tools/release-android.js",
|
||||||
"releaseCli": "node packages/tools/release-cli.js",
|
"releaseCli": "node packages/tools/release-cli.js",
|
||||||
"releaseClipper": "node packages/tools/release-clipper.js",
|
"releaseClipper": "node packages/tools/release-clipper.js",
|
||||||
"releaseDesktop": "node packages/tools/release-electron.js",
|
"releaseDesktop": "node packages/tools/release-electron.js",
|
||||||
|
"releaseIOS": "node packages/tools/release-ios.js",
|
||||||
"releasePluginGenerator": "node packages/tools/release-plugin-generator.js",
|
"releasePluginGenerator": "node packages/tools/release-plugin-generator.js",
|
||||||
"releaseServer": "node packages/tools/release-server.js",
|
"releaseServer": "node packages/tools/release-server.js",
|
||||||
"setupNewRelease": "node ./packages/tools/setupNewRelease",
|
"setupNewRelease": "node ./packages/tools/setupNewRelease",
|
||||||
|
|
|
@ -1,56 +1,59 @@
|
||||||
|
'use strict';
|
||||||
|
const __awaiter = (this && this.__awaiter) || function(thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function(resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function(resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator['throw'](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
const fs = require('fs-extra');
|
const fs = require('fs-extra');
|
||||||
const { execCommandVerbose, rootDir, gitPullTry } = require('./tool-utils.js');
|
const tool_utils_1 = require('./tool-utils');
|
||||||
|
const mobileDir = `${tool_utils_1.rootDir}/packages/app-mobile`;
|
||||||
const mobileDir = `${rootDir}/packages/app-mobile`;
|
function updateCodeProjVersions(filePath) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
async function updateCodeProjVersions(filePath) {
|
const originalContent = yield fs.readFile(filePath, 'utf8');
|
||||||
const originalContent = await fs.readFile(filePath, 'utf8');
|
|
||||||
let newContent = originalContent;
|
let newContent = originalContent;
|
||||||
let newVersion = '';
|
let newVersion = '';
|
||||||
|
|
||||||
// MARKETING_VERSION = 10.1.0;
|
// MARKETING_VERSION = 10.1.0;
|
||||||
newContent = newContent.replace(/(MARKETING_VERSION = )(\d+\.\d+)\.(\d+)(.*)/g, function(_match, prefix, majorMinorVersion, buildNum, suffix) {
|
newContent = newContent.replace(/(MARKETING_VERSION = )(\d+\.\d+)\.(\d+)(.*)/g, function(_match, prefix, majorMinorVersion, buildNum, suffix) {
|
||||||
const n = Number(buildNum);
|
const n = Number(buildNum);
|
||||||
if (isNaN(n)) throw new Error(`Invalid version code: ${buildNum}`);
|
if (isNaN(n)) { throw new Error(`Invalid version code: ${buildNum}`); }
|
||||||
newVersion = `${majorMinorVersion}.${n + 1}`;
|
newVersion = `${majorMinorVersion}.${n + 1}`;
|
||||||
return `${prefix}${newVersion}${suffix}`;
|
return `${prefix}${newVersion}${suffix}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
// CURRENT_PROJECT_VERSION = 58;
|
// CURRENT_PROJECT_VERSION = 58;
|
||||||
newContent = newContent.replace(/(CURRENT_PROJECT_VERSION = )(\d+)(.*)/g, function(_match, prefix, projectVersion, suffix) {
|
newContent = newContent.replace(/(CURRENT_PROJECT_VERSION = )(\d+)(.*)/g, function(_match, prefix, projectVersion, suffix) {
|
||||||
const n = Number(projectVersion);
|
const n = Number(projectVersion);
|
||||||
if (isNaN(n)) throw new Error(`Invalid version code: ${projectVersion}`);
|
if (isNaN(n)) { throw new Error(`Invalid version code: ${projectVersion}`); }
|
||||||
return `${prefix}${n + 1}${suffix}`;
|
return `${prefix}${n + 1}${suffix}`;
|
||||||
});
|
});
|
||||||
|
if (!newVersion) { throw new Error('Could not determine new version'); }
|
||||||
if (!newVersion) throw new Error('Could not determine new version');
|
if (newContent === originalContent) { throw new Error('No change was made to project file'); }
|
||||||
if (newContent === originalContent) throw new Error('No change was made to project file');
|
yield fs.writeFile(filePath, newContent, 'utf8');
|
||||||
|
|
||||||
await fs.writeFile(filePath, newContent, 'utf8');
|
|
||||||
|
|
||||||
return newVersion;
|
return newVersion;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
function main() {
|
||||||
async function main() {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
await gitPullTry();
|
yield tool_utils_1.gitPullTry();
|
||||||
|
|
||||||
console.info('Updating version numbers...');
|
console.info('Updating version numbers...');
|
||||||
|
const newVersion = yield updateCodeProjVersions(`${mobileDir}/ios/Joplin.xcodeproj/project.pbxproj`);
|
||||||
const newVersion = await updateCodeProjVersions(`${mobileDir}/ios/Joplin.xcodeproj/project.pbxproj`);
|
|
||||||
console.info(`New version: ${newVersion}`);
|
console.info(`New version: ${newVersion}`);
|
||||||
|
|
||||||
const tagName = `ios-v${newVersion}`;
|
const tagName = `ios-v${newVersion}`;
|
||||||
await execCommandVerbose('git', ['add', '-A']);
|
yield tool_utils_1.execCommand2('git add -A');
|
||||||
await execCommandVerbose('git', ['commit', '-m', tagName]);
|
yield tool_utils_1.execCommand2(`git commit -m "${tagName}"`);
|
||||||
await execCommandVerbose('git', ['tag', tagName]);
|
yield tool_utils_1.execCommand2(`git tag ${tagName}`);
|
||||||
await execCommandVerbose('git', ['push']);
|
yield tool_utils_1.execCommand2('git push');
|
||||||
await execCommandVerbose('git', ['push', '--tags']);
|
yield tool_utils_1.execCommand2('git push --tags');
|
||||||
|
|
||||||
console.info(`To create changelog: node packages/tools/git-changelog.js ${tagName}`);
|
console.info(`To create changelog: node packages/tools/git-changelog.js ${tagName}`);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
main().catch((error) => {
|
main().catch((error) => {
|
||||||
console.error('Fatal error');
|
console.error('Fatal error');
|
||||||
console.error(error);
|
console.error(error);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
// # sourceMappingURL=release-ios.js.map
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
import * as fs from 'fs-extra';
|
||||||
|
import { execCommand2, rootDir, gitPullTry } from './tool-utils';
|
||||||
|
|
||||||
|
const mobileDir = `${rootDir}/packages/app-mobile`;
|
||||||
|
|
||||||
|
async function updateCodeProjVersions(filePath: string) {
|
||||||
|
const originalContent = await fs.readFile(filePath, 'utf8');
|
||||||
|
let newContent = originalContent;
|
||||||
|
let newVersion = '';
|
||||||
|
|
||||||
|
// MARKETING_VERSION = 10.1.0;
|
||||||
|
newContent = newContent.replace(/(MARKETING_VERSION = )(\d+\.\d+)\.(\d+)(.*)/g, function(_match, prefix, majorMinorVersion, buildNum, suffix) {
|
||||||
|
const n = Number(buildNum);
|
||||||
|
if (isNaN(n)) throw new Error(`Invalid version code: ${buildNum}`);
|
||||||
|
newVersion = `${majorMinorVersion}.${n + 1}`;
|
||||||
|
return `${prefix}${newVersion}${suffix}`;
|
||||||
|
});
|
||||||
|
|
||||||
|
// CURRENT_PROJECT_VERSION = 58;
|
||||||
|
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}`;
|
||||||
|
});
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 tagName = `ios-v${newVersion}`;
|
||||||
|
await execCommand2('git add -A');
|
||||||
|
await execCommand2(`git commit -m "${tagName}"`);
|
||||||
|
await execCommand2(`git tag ${tagName}`);
|
||||||
|
await execCommand2('git push');
|
||||||
|
await execCommand2('git push --tags');
|
||||||
|
|
||||||
|
console.info(`To create changelog: node packages/tools/git-changelog.js ${tagName}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
main().catch((error) => {
|
||||||
|
console.error('Fatal error');
|
||||||
|
console.error(error);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
Loading…
Reference in New Issue