2017-07-14 20:21:07 +02:00
|
|
|
var ghrelease = require('gh-release');
|
|
|
|
var currentChangelog = require('./current-changelog.js');
|
|
|
|
var safeParse = require('safe-json-parse/tuple');
|
|
|
|
var pkg = require('../package.json')
|
2017-07-14 21:27:48 +02:00
|
|
|
var minimist = require('minimist');
|
|
|
|
|
|
|
|
var args = minimist(process.argv.slice(2), {
|
|
|
|
boolean: ['prerelease'],
|
|
|
|
default: {
|
|
|
|
prerelease: false
|
|
|
|
},
|
|
|
|
alias: {
|
|
|
|
p: 'prerelease'
|
|
|
|
}
|
2017-07-14 21:48:49 +02:00
|
|
|
});
|
2017-07-14 20:21:07 +02:00
|
|
|
|
|
|
|
var options = {
|
|
|
|
owner: 'videojs',
|
|
|
|
repo: 'video.js',
|
|
|
|
body: currentChangelog(),
|
2017-07-14 21:27:48 +02:00
|
|
|
assets: ['./dist/video-js-'+pkg.version+'.zip'],
|
2017-07-14 20:21:07 +02:00
|
|
|
endpoint: 'https://api.github.com',
|
|
|
|
auth: {
|
|
|
|
username: process.env.VJS_GITHUB_USER,
|
|
|
|
password: process.env.VJS_GITHUB_TOKEN
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
var tuple = safeParse(process.env.npm_config_argv);
|
|
|
|
var npmargs = tuple[0] ? [] : tuple[1].cooked;
|
|
|
|
|
2017-07-14 21:27:48 +02:00
|
|
|
if (args.prerelease || npmargs.some(function(arg) { return /next/.test(arg); })) {
|
2017-07-14 20:21:07 +02:00
|
|
|
options.prerelease = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
ghrelease(options, function(err, result) {
|
|
|
|
if (err) {
|
2017-10-10 20:35:50 +02:00
|
|
|
console.error('Unable to publish release to github');
|
|
|
|
console.error('err:', err);
|
|
|
|
console.error('result:', result);
|
2017-07-14 20:21:07 +02:00
|
|
|
} else {
|
|
|
|
console.log('Publish release to github!');
|
|
|
|
}
|
|
|
|
});
|