2018-03-09 22:59:12 +02:00
|
|
|
const { execCommand, githubRelease, handleCommitHook, githubOauthToken } = require('./tool-utils.js');
|
|
|
|
const path = require('path');
|
2018-02-04 19:42:33 +02:00
|
|
|
|
|
|
|
const rootDir = path.dirname(__dirname);
|
2018-03-09 22:59:12 +02:00
|
|
|
const appDir = rootDir + '/ElectronClient/app';
|
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
|
|
|
const oauthToken = await githubOauthToken();
|
|
|
|
process.chdir(appDir);
|
|
|
|
|
2018-03-09 22:59:12 +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;
|
|
|
|
|
2018-03-09 22:59:12 +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'));
|
2018-02-04 19:42:33 +02:00
|
|
|
console.info(await execCommand('git commit -m "Electron release ' + version + '"'));
|
2018-03-09 22:59:12 +02:00
|
|
|
console.info(await execCommand('git tag ' + tagName));
|
|
|
|
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
|
|
|
|
2018-03-09 22:59:12 +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);
|
2018-03-09 22:59:12 +02:00
|
|
|
});
|