From c77a8d0f9f7e155cd1ba085e5fd7ed4c1137c2f0 Mon Sep 17 00:00:00 2001 From: Victorien Elvinger Date: Mon, 11 Apr 2016 23:26:57 +0200 Subject: [PATCH] feat(cli): add tag signing option (--sign-tag and its alias -s) By default, a tag is not signed (git tag -a). The option `--sign-tag` enables tag signing (git tag -s). --- index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 5a18542b9..b7e74f219 100755 --- a/index.js +++ b/index.js @@ -24,6 +24,13 @@ var argv = require('yargs') default: false, global: true }) + .option('sign-tag', { + alias: 's', + describe: 'Should the git tag be signed?', + type: 'boolean', + default: false, + global: true + }) .help() .alias('help', 'h') .example('$0', 'Update changelog and tag release') @@ -123,8 +130,14 @@ function formatCommitMessage (msg, newVersion) { } function tag (newVersion, argv) { + var tagOption + if (argv.signTag) { + tagOption = '-s ' + } else { + tagOption = '-a ' + } checkpoint('tagging release %s', [newVersion]) - exec('git tag -a v' + newVersion + ' -m "' + argv.message + '"', function (err, stdout, stderr) { + exec('git tag ' + tagOption + 'v' + newVersion + ' -m "' + argv.message + '"', function (err, stdout, stderr) { var errMessage = null if (err) errMessage = err.message if (stderr) errMessage = stderr