1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +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'); 'use strict';
const __awaiter = (this && this.__awaiter) || function(thisArg, _arguments, P, generator) {
const appDir = `${rootDir}/packages/app-desktop`; function adopt(value) { return value instanceof P ? value : new P(function(resolve) { resolve(value); }); }
return new (P || (P = Promise))(function(resolve, reject) {
async function main() { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
const argv = require('yargs').argv; 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); }
process.chdir(appDir); step((generator = generator.apply(thisArg, _arguments || [])).next());
});
console.info(`Running from: ${process.cwd()}`); };
Object.defineProperty(exports, '__esModule', { value: true });
const version = (await execCommand('npm version patch')).trim(); const tool_utils_1 = require('./tool-utils');
const tagName = version; const appDir = `${tool_utils_1.rootDir}/packages/app-desktop`;
function main() {
console.info(`New version number: ${version}`); return __awaiter(this, void 0, void 0, function* () {
yield tool_utils_1.gitPullTry(false);
console.info(await execCommand('git add -A')); const argv = require('yargs').argv;
console.info(await execCommand(`git commit -m "Desktop release ${version}"`)); process.chdir(appDir);
console.info(await execCommand(`git tag ${tagName}`)); console.info(`Running from: ${process.cwd()}`);
console.info(await execCommand('git push && git push --tags')); const version = (yield tool_utils_1.execCommand2('npm version patch')).trim();
const tagName = version;
const releaseOptions = { isDraft: true, isPreRelease: !!argv.beta }; console.info(`New version number: ${version}`);
console.info(yield tool_utils_1.execCommand2('git add -A'));
console.info('Release options: ', releaseOptions); console.info(yield tool_utils_1.execCommand2(`git commit -m "Desktop release ${version}"`));
console.info(yield tool_utils_1.execCommand2(`git tag ${tagName}`));
const release = await githubRelease('joplin', tagName, releaseOptions); console.info(yield tool_utils_1.execCommand2('git push && git push --tags'));
const releaseOptions = { isDraft: true, isPreRelease: !!argv.beta };
console.info(`Created GitHub release: ${release.html_url}`); console.info('Release options: ', releaseOptions);
console.info('GitHub release page: https://github.com/laurent22/joplin/releases'); const release = yield tool_utils_1.githubRelease('joplin', tagName, releaseOptions);
console.info(`To create changelog: node packages/tools/git-changelog.js ${version}`); 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) => { 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-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()}`); 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 { try {
await execCommand('git pull'); await execCommand('git pull');
} catch (error) { } 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'); console.info('Skipping git pull because no tracking information on current branch');
} else { } else {
throw error; throw error;