UNPKG

@busy-web/deploy

Version:

busy-web ember-cli-deploy addon.

64 lines (53 loc) 1.76 kB
/** * @module Commands * */ var RSVP = require('rsvp'); var npmUtil = require('../helpers/npm'); var gitUtil = require('../helpers/git'); var versionUtil = require('../helpers/version'); /** * `ember deploy:production` * */ module.exports = { name: 'deploy:production', description: 'Update the package version and commit it to the repo for production builds', works: 'insideProject', availableOptions: [ { name: 'patch', type: Boolean, default: false, alias: ['p'] }, { name: 'minor', type: Boolean, default: false, alias: ['m'] }, { name: 'major', type: Boolean, default: false, alias: ['M'] }, { name: 'tag' , type: String, default: null, alias: ['t'] }, ], anonymousOptions: ['<remote>'], run: function(commandOptions, rawArgs) { var remote = rawArgs.length ? rawArgs.shift() : 'origin'; var vTag = commandOptions.major ? 'major' : commandOptions.minor ? 'minor' : 'patch'; versionUtil.getVersion(); if (commandOptions.tag !== null) { if (commandOptions.tag.length) { vTag = commandOptions.tag; } if (!versionUtil.isValid(vTag)) { vTag = versionUtil.package.version; } } // create a new version tag return npmUtil.tag(vTag).then(version => { versionUtil.syncVersion(); // update changelog return npmUtil.changelog({ [vTag]: true }).then(() => { // commit changes to git return gitUtil.commit("Production release [ " + version + " ] [ci skip]").then(() => { this.ui.write("Release: " + version + "\n\n"); // push tags to remote, default remote is origin return gitUtil.push('--tags', remote).then(() => { this.ui.write("Production deploy pushed to " + remote + " v" + version + "\n"); return RSVP.Promise.resolve(); }); }); }); }); } };