mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-27 08:21:03 +02:00
Tools: IOS release script
This commit is contained in:
parent
e673ce132e
commit
f24f8e8b47
@ -8,8 +8,8 @@
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"bootstrap": "lerna bootstrap --no-ci",
|
||||
"bootstrapServerOnly": "lerna bootstrap --no-ci --include-dependents --include-dependencies --scope @joplin/server",
|
||||
"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",
|
||||
"buildApiDoc": "npm start --prefix=packages/app-cli -- apidoc ../../readme/api/references/rest_api.md",
|
||||
"buildDoc": "./packages/tools/build-all.sh",
|
||||
@ -18,8 +18,8 @@
|
||||
"buildTranslationsNoTsc": "node packages/tools/build-translation.js",
|
||||
"buildWebsite": "npm run buildApiDoc && node ./packages/tools/build-website.js && npm run buildPluginDoc",
|
||||
"circularDependencyCheck": "madge --warning --circular --extensions js ./",
|
||||
"dependencyTree": "madge",
|
||||
"clean": "lerna clean -y && lerna run clean",
|
||||
"dependencyTree": "madge",
|
||||
"generateDatabaseTypes": "node packages/tools/generate-database-types",
|
||||
"linkChecker": "linkchecker https://joplinapp.org",
|
||||
"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",
|
||||
"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",
|
||||
"releaseAndroidClean": "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",
|
||||
"releaseClipper": "node packages/tools/release-clipper.js",
|
||||
"releaseDesktop": "node packages/tools/release-electron.js",
|
||||
"releaseIOS": "node packages/tools/release-ios.js",
|
||||
"releasePluginGenerator": "node packages/tools/release-plugin-generator.js",
|
||||
"releaseServer": "node packages/tools/release-server.js",
|
||||
"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 { execCommandVerbose, rootDir, gitPullTry } = require('./tool-utils.js');
|
||||
|
||||
const mobileDir = `${rootDir}/packages/app-mobile`;
|
||||
|
||||
async function updateCodeProjVersions(filePath) {
|
||||
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}`;
|
||||
const tool_utils_1 = require('./tool-utils');
|
||||
const mobileDir = `${tool_utils_1.rootDir}/packages/app-mobile`;
|
||||
function updateCodeProjVersions(filePath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const originalContent = yield 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'); }
|
||||
yield fs.writeFile(filePath, newContent, 'utf8');
|
||||
return newVersion;
|
||||
});
|
||||
|
||||
// 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}`;
|
||||
}
|
||||
function main() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield tool_utils_1.gitPullTry();
|
||||
console.info('Updating version numbers...');
|
||||
const newVersion = yield updateCodeProjVersions(`${mobileDir}/ios/Joplin.xcodeproj/project.pbxproj`);
|
||||
console.info(`New version: ${newVersion}`);
|
||||
const tagName = `ios-v${newVersion}`;
|
||||
yield tool_utils_1.execCommand2('git add -A');
|
||||
yield tool_utils_1.execCommand2(`git commit -m "${tagName}"`);
|
||||
yield tool_utils_1.execCommand2(`git tag ${tagName}`);
|
||||
yield tool_utils_1.execCommand2('git push');
|
||||
yield tool_utils_1.execCommand2('git push --tags');
|
||||
console.info(`To create changelog: node packages/tools/git-changelog.js ${tagName}`);
|
||||
});
|
||||
|
||||
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 execCommandVerbose('git', ['add', '-A']);
|
||||
await execCommandVerbose('git', ['commit', '-m', tagName]);
|
||||
await execCommandVerbose('git', ['tag', tagName]);
|
||||
await execCommandVerbose('git', ['push']);
|
||||
await execCommandVerbose('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);
|
||||
});
|
||||
// # sourceMappingURL=release-ios.js.map
|
||||
|
56
packages/tools/release-ios.ts
Normal file
56
packages/tools/release-ios.ts
Normal file
@ -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
Block a user