mirror of
https://github.com/videojs/video.js.git
synced 2024-12-02 09:11:54 +02:00
e8511a5799
We've been printing the resulting value from a successful call to the ghrelease, this was useful for debugging but isn't necessary anymore. Add the result to the error conditional with some headings.
45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
var ghrelease = require('gh-release');
|
|
var currentChangelog = require('./current-changelog.js');
|
|
var safeParse = require('safe-json-parse/tuple');
|
|
var pkg = require('../package.json')
|
|
var minimist = require('minimist');
|
|
|
|
var args = minimist(process.argv.slice(2), {
|
|
boolean: ['prerelease'],
|
|
default: {
|
|
prerelease: false
|
|
},
|
|
alias: {
|
|
p: 'prerelease'
|
|
}
|
|
});
|
|
|
|
var options = {
|
|
owner: 'videojs',
|
|
repo: 'video.js',
|
|
body: currentChangelog(),
|
|
assets: ['./dist/video-js-'+pkg.version+'.zip'],
|
|
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;
|
|
|
|
if (args.prerelease || npmargs.some(function(arg) { return /next/.test(arg); })) {
|
|
options.prerelease = true;
|
|
}
|
|
|
|
ghrelease(options, function(err, result) {
|
|
if (err) {
|
|
console.error('Unable to publish release to github');
|
|
console.error('err:', err);
|
|
console.error('result:', result);
|
|
} else {
|
|
console.log('Publish release to github!');
|
|
}
|
|
});
|