zapier-platform-cli
Version:
The CLI for apps in the Zapier Developer Platform.
33 lines (29 loc) • 2.34 kB
JavaScript
;
var utils = require('../utils');
var promote = function promote(context, version) {
if (!version) {
context.line('Error: No deploment/version selected...\n');
return Promise.resolve();
}
return utils.checkCredentials().then(function () {
return utils.getLinkedApp();
}).then(function (app) {
context.line('Preparing to promote version ' + version + ' your app "' + app.title + '".\n');
var url = '/apps/' + app.id + '/versions/' + version + '/promote/production';
utils.printStarting('Promoting ' + version);
return utils.callAPI(url, {
method: 'PUT',
body: {}
});
}).then(function () {
utils.printDone();
context.line(' Promotion successful!\n');
context.line('Optionally try the `zapier migrate 1.0.0 1.0.1 [10%]` command to move users to this version.');
});
};
promote.argsSpec = [{ name: 'version', example: '1.0.0', required: true }];
promote.argOptsSpec = {};
promote.help = 'Promotes a specific version to public access.';
promote.example = 'zapier promote 1.0.0';
promote.docs = '\nPromotes an app version into production (non-private) rotation, which means new users can use this app version.\n\n* This **does** mark the version as the official public version - all other versions & users are grandfathered.\n* This **does not** build/upload or deploy a version to Zapier - you should `zapier push` first.\n* This **does not** move old users over to this version - `zapier migrate 1.0.0 1.0.1` does that.\n* This **does not** recommend old users stop using this version - `zapier deprecate 1.0.0 2017-01-01` does that.\n\nPromotes are an inherently safe operation for all existing users of your app.\n\n> If this is your first time promoting - this will start the platform quality assurance process by alerting the Zapier platform team of your intent to make your app public. We\'ll respond within a few business days.\n\n**Arguments**\n\n' + utils.argsFragment(promote.argsSpec) + '\n' + utils.argOptsFragment(promote.argOptsSpec) + '\n\n' + '```' + 'bash\n$ zapier promote 1.0.0\n# Preparing to promote version 1.0.0 your app "Example".\n#\n# Promoting 1.0.0 - done!\n# Promotion successful!\n#\n# Optionally try the `zapier migrate 1.0.0 1.0.1 [10%]` command to move users to this version.\n' + '```' + '\n';
module.exports = promote;