1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-03-26 21:12:59 +02:00

Tools: Minor tweaks on desktop release script

This commit is contained in:
Laurent Cozic 2021-01-19 23:02:58 +00:00
parent 4e2e26f033
commit ddf3e16ff0
3 changed files with 75 additions and 33 deletions

View File

@ -1,37 +1,40 @@
const { execCommand, githubRelease, rootDir } = require('./tool-utils.js');
const appDir = `${rootDir}/packages/app-desktop`;
async function main() {
const argv = require('yargs').argv;
process.chdir(appDir);
console.info(`Running from: ${process.cwd()}`);
const version = (await execCommand('npm version patch')).trim();
const tagName = version;
console.info(`New version number: ${version}`);
console.info(await execCommand('git add -A'));
console.info(await execCommand(`git commit -m "Desktop release ${version}"`));
console.info(await execCommand(`git tag ${tagName}`));
console.info(await execCommand('git push && git push --tags'));
const releaseOptions = { isDraft: true, isPreRelease: !!argv.beta };
console.info('Release options: ', releaseOptions);
const release = await githubRelease('joplin', tagName, releaseOptions);
console.info(`Created GitHub release: ${release.html_url}`);
console.info('GitHub release page: https://github.com/laurent22/joplin/releases');
console.info(`To create changelog: node packages/tools/git-changelog.js ${version}`);
'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 tool_utils_1 = require('./tool-utils');
const appDir = `${tool_utils_1.rootDir}/packages/app-desktop`;
function main() {
return __awaiter(this, void 0, void 0, function* () {
yield tool_utils_1.gitPullTry(false);
const argv = require('yargs').argv;
process.chdir(appDir);
console.info(`Running from: ${process.cwd()}`);
const version = (yield tool_utils_1.execCommand2('npm version patch')).trim();
const tagName = version;
console.info(`New version number: ${version}`);
console.info(yield tool_utils_1.execCommand2('git add -A'));
console.info(yield tool_utils_1.execCommand2(`git commit -m "Desktop release ${version}"`));
console.info(yield tool_utils_1.execCommand2(`git tag ${tagName}`));
console.info(yield tool_utils_1.execCommand2('git push && git push --tags'));
const releaseOptions = { isDraft: true, isPreRelease: !!argv.beta };
console.info('Release options: ', releaseOptions);
const release = yield tool_utils_1.githubRelease('joplin', tagName, releaseOptions);
console.info(`Created GitHub release: ${release.html_url}`);
console.info('GitHub release page: https://github.com/laurent22/joplin/releases');
console.info(`To create changelog: node packages/tools/git-changelog.js ${version}`);
});
}
main().catch((error) => {
console.error('Fatal error');
console.error(error);
process.exit(1);
});
// # sourceMappingURL=release-electron.js.map

View File

@ -0,0 +1,39 @@
import { execCommand2, githubRelease, gitPullTry, rootDir } from './tool-utils';
const appDir = `${rootDir}/packages/app-desktop`;
async function main() {
await gitPullTry(false);
const argv = require('yargs').argv;
process.chdir(appDir);
console.info(`Running from: ${process.cwd()}`);
const version = (await execCommand2('npm version patch')).trim();
const tagName = version;
console.info(`New version number: ${version}`);
console.info(await execCommand2('git add -A'));
console.info(await execCommand2(`git commit -m "Desktop release ${version}"`));
console.info(await execCommand2(`git tag ${tagName}`));
console.info(await execCommand2('git push && git push --tags'));
const releaseOptions = { isDraft: true, isPreRelease: !!argv.beta };
console.info('Release options: ', releaseOptions);
const release = await githubRelease('joplin', tagName, releaseOptions);
console.info(`Created GitHub release: ${release.html_url}`);
console.info('GitHub release page: https://github.com/laurent22/joplin/releases');
console.info(`To create changelog: node packages/tools/git-changelog.js ${version}`);
}
main().catch((error) => {
console.error('Fatal error');
console.error(error);
process.exit(1);
});

View File

@ -258,11 +258,11 @@ export async function gitRepoCleanTry() {
if (!(await gitRepoClean())) throw new Error(`There are pending changes in the repository: ${process.cwd()}`);
}
export async function gitPullTry() {
export async function gitPullTry(ignoreIfNotBranch = true) {
try {
await execCommand('git pull');
} catch (error) {
if (error.message.includes('no tracking information for the current branch')) {
if (ignoreIfNotBranch && error.message.includes('no tracking information for the current branch')) {
console.info('Skipping git pull because no tracking information on current branch');
} else {
throw error;