Skip to content

Instantly share code, notes, and snippets.

@duvillierA
Last active August 29, 2015 14:24
Show Gist options
  • Save duvillierA/f9acfb3a8d397fd5a493 to your computer and use it in GitHub Desktop.
Save duvillierA/f9acfb3a8d397fd5a493 to your computer and use it in GitHub Desktop.
Release to git with a gulp task
var
gulp = require('gulp'),
semver = require('semver'),
$ = require('gulp-load-plugins')();
var inc = function(importance) {
return gulp.src(['./package.json'])
.pipe($.bump({type: importance}))
.pipe(gulp.dest('./'))
.pipe($.git.commit('Release v' + semver.inc(
require(__dirname + '/package.json').version,
importance)))
.pipe($.tagVersion())
.pipe($.git.push('origin', 'master', { args: '--tags' }));
};
/* Version bumping ------------------------------------------------------- */
gulp.task('patch', function() { return inc('patch'); });
gulp.task('feature', function() { return inc('minor'); });
gulp.task('release', function() { return inc('major'); });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment