2019-06-20 19:37:28 +07:00
|
|
|
'use strict';
|
2019-04-09 04:36:39 +07:00
|
|
|
|
2019-06-20 19:37:28 +07:00
|
|
|
const [, , /* node */ /* file */ tag] = process.argv;
|
2019-04-09 04:36:39 +07:00
|
|
|
|
2019-06-20 19:37:28 +07:00
|
|
|
const getStdin = require('get-stdin');
|
2019-04-09 04:36:39 +07:00
|
|
|
const Octokit = require('@octokit/rest');
|
|
|
|
const octokit = new Octokit({
|
2019-06-20 19:37:28 +07:00
|
|
|
auth: `token ${process.env.GITHUB_TOKEN}`,
|
2019-04-09 04:36:39 +07:00
|
|
|
});
|
|
|
|
|
2019-06-20 19:37:28 +07:00
|
|
|
const [repoOwner, repoName] = process.env.GITHUB_REPOSITORY.split('/');
|
2019-04-09 04:36:39 +07:00
|
|
|
|
|
|
|
getStdin()
|
2019-06-20 19:37:28 +07:00
|
|
|
.then(changelog =>
|
|
|
|
octokit.repos.createRelease({
|
|
|
|
owner: repoOwner,
|
|
|
|
repo: repoName,
|
|
|
|
tag_name: tag,
|
|
|
|
body: changelog,
|
2020-04-03 02:38:21 +07:00
|
|
|
draft: false,
|
2019-06-20 19:37:28 +07:00
|
|
|
})
|
|
|
|
)
|
|
|
|
.catch(err => {
|
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
console.error(err);
|
|
|
|
process.exit(1);
|
|
|
|
});
|