forked from ferreiratiago/gulp-git-push
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
39 lines (36 loc) · 1.08 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
var gulp = require('gulp');
var git = require('gulp-git');
var bump = require('gulp-bump');
var filter = require('gulp-filter');
var tag = require('gulp-tag-version');
var push = require('./index.js');
var argv = require('yargs')
.option('type', {
alias: 't',
choices: ['patch', 'minor', 'major']
}).argv;
var options = {
dest: './',
versionToBump: './package.json',
versionToTag: 'package.json',
bumpType: 'patch',
commitMessage: 'bump package version'
}
/**
* Bumping version number.
* Please read http://semver.org/
*
* You can use the commands
* gulp release --type=patch # makes v0.1.0 → v0.1.1
* gulp release --type=minor # makes v0.1.1 → v0.2.0
* gulp release --type=major # makes v0.2.1 → v1.0.0
*/
gulp.task('release', function () {
return gulp.src(options.versionToBump)
.pipe(bump({type: argv.type || options.bumpType}))
.pipe(gulp.dest(options.dest))
.pipe(git.commit(options.commitMessage))
.pipe(filter(options.versionToTag))
.pipe(tag())
.pipe(push());
});