Skip to content

Commit

Permalink
feat: add gitPushOptions and gitPushTagOptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephane Labruyere committed Feb 3, 2017
1 parent 9caca37 commit 10d2adc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ grunt.initConfig({
tagMessage: 'Version %VERSION%',
push: true,
pushTo: 'upstream',
gitPushOptions: '',
gitPushTagOptions: '',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',
globalReplace: false,
prereleaseName: false,
Expand Down Expand Up @@ -138,6 +140,18 @@ Default value: `upstream`

If `options.push` is set to a truthy value, which remote repo should it go to? This is what gets set as `remote` in the `git push {remote} {branch}` command. Use `git remote` to see the list of remote repo's you have listed. [Learn about remote repos](http://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes)

#### options.gitPushOptions
Type: `String`
Default value: ``

Options to use with `$ git push`

#### options.gitPushTagOptions
Type: `String`
Default value: ``

Options to use with `$ git push vx.y.z`

#### options.gitDescribeOptions
Type: `String`
Default value: `--tags --always --abbrev=1 --dirty=-d`
Expand Down
8 changes: 5 additions & 3 deletions tasks/bump.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ module.exports = function(grunt) {
files: ['package.json'],
gitCommitOptions: '',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',
gitPushOptions: '',
gitPushTagOptions: '',
globalReplace: false,
prereleaseName: false,
metadata: '',
Expand Down Expand Up @@ -227,7 +229,7 @@ module.exports = function(grunt) {
var cmd;

if (opts.push === 'git' && !opts.pushTo) {
cmd = 'git push';
cmd = 'git push ' + opts.gitPushOptions;
if (dryRun) {
grunt.log.ok('bump-dry: ' + cmd);
next();
Expand All @@ -254,12 +256,12 @@ module.exports = function(grunt) {
cmd = [];

if (opts.push === true || opts.push === 'branch') {
cmd.push('git push ' + opts.pushTo + ' ' + ref.trim());
cmd.push('git push ' + opts.pushTo + ' ' + ref.trim() + ' ' + opts.gitPushOptions);
}

if (opts.createTag && (opts.push === true || opts.push === 'tag')) {
var tagName = opts.tagName.replace('%VERSION%', globalVersion);
cmd.push('git push ' + opts.pushTo + ' ' + tagName);
cmd.push('git push ' + opts.pushTo + ' ' + tagName + ' ' + opts.gitPushTagOptions);
}

cmd = cmd.join(' && ');
Expand Down

0 comments on commit 10d2adc

Please sign in to comment.