2019-07-30 09:35:42 +02:00
|
|
|
const { execCommand, githubRelease } = require('./tool-utils.js');
|
2018-03-09 22:59:12 +02:00
|
|
|
const path = require('path');
|
2018-02-04 19:42:33 +02:00
|
|
|
|
|
|
|
const rootDir = path.dirname(__dirname);
|
2020-02-21 00:59:18 +02:00
|
|
|
const appDir = `${rootDir}/ElectronClient`;
|
2018-02-04 19:42:33 +02:00
|
|
|
|
|
|
|
async function main() {
|
2019-01-12 00:07:23 +02:00
|
|
|
const argv = require('yargs').argv;
|
|
|
|
|
2018-02-04 19:42:33 +02:00
|
|
|
process.chdir(appDir);
|
|
|
|
|
2019-09-19 23:51:18 +02:00
|
|
|
console.info(`Running from: ${process.cwd()}`);
|
2018-02-04 19:42:33 +02:00
|
|
|
|
2018-03-09 22:59:12 +02:00
|
|
|
const version = (await execCommand('npm version patch')).trim();
|
2018-02-04 19:42:33 +02:00
|
|
|
const tagName = version;
|
|
|
|
|
2019-09-19 23:51:18 +02:00
|
|
|
console.info(`New version number: ${version}`);
|
2018-02-04 19:42:33 +02:00
|
|
|
|
2018-03-09 22:59:12 +02:00
|
|
|
console.info(await execCommand('git add -A'));
|
2019-09-19 23:51:18 +02:00
|
|
|
console.info(await execCommand(`git commit -m "Electron release ${version}"`));
|
|
|
|
console.info(await execCommand(`git tag ${tagName}`));
|
2018-03-09 22:59:12 +02:00
|
|
|
console.info(await execCommand('git push && git push --tags'));
|
2018-02-04 19:42:33 +02:00
|
|
|
|
2019-01-12 00:07:23 +02:00
|
|
|
const releaseOptions = { isDraft: true, isPreRelease: !!argv.beta };
|
|
|
|
|
2019-01-12 01:40:05 +02:00
|
|
|
console.info('Release options: ', releaseOptions);
|
2019-01-12 00:07:23 +02:00
|
|
|
|
|
|
|
const release = await githubRelease('joplin', tagName, releaseOptions);
|
2018-02-04 19:42:33 +02:00
|
|
|
|
2019-09-19 23:51:18 +02:00
|
|
|
console.info(`Created GitHub release: ${release.html_url}`);
|
2018-02-04 19:42:33 +02:00
|
|
|
}
|
|
|
|
|
2018-03-09 22:59:12 +02:00
|
|
|
main().catch((error) => {
|
|
|
|
console.error('Fatal error');
|
2018-02-04 19:42:33 +02:00
|
|
|
console.error(error);
|
2018-03-23 19:32:29 +02:00
|
|
|
process.exit(1);
|
2019-07-30 09:35:42 +02:00
|
|
|
});
|