Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add gitPushOptions and gitPushTagOptions. #201

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the options go before the refs?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

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