41 lines
796 B
JavaScript
Executable File
41 lines
796 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
'use strict'
|
|
|
|
var argv = require('minimist')(process.argv.slice(2), {
|
|
alias: {
|
|
d: 'debug',
|
|
dry: 'debug',
|
|
t: 'token'
|
|
},
|
|
default: {
|
|
token: process.env.GH_TOKEN || process.env.TOKEN || process.env.GITHUB_TOKEN
|
|
}
|
|
})
|
|
|
|
if (~argv._.indexOf('pre')) {
|
|
console.log('Determining new version')
|
|
|
|
return require('../src/pre')(argv, function (err, result) {
|
|
if (err) {
|
|
console.log('Something went wrong.')
|
|
throw err
|
|
}
|
|
|
|
if (!result) {
|
|
console.log('Nothing changed. Not publishing.')
|
|
process.exit(1)
|
|
}
|
|
|
|
console.log('Publishing v' + result)
|
|
})
|
|
}
|
|
|
|
if (~argv._.indexOf('post')) {
|
|
return require('../src/post')(argv, function (err) {
|
|
if (err) {
|
|
console.log('Something went wrong.')
|
|
throw err
|
|
}
|
|
})
|
|
}
|