-
Notifications
You must be signed in to change notification settings - Fork 29
/
gulpfile.js
59 lines (45 loc) · 1.05 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
var gulp = require('gulp');
var bump = require('gulp-bump');
var git = require("gulp-git");
/**
* Version bump tasks
*/
function getBumpTask(type) {
return function () {
return gulp.src(['./package.json', './bower.json'])
.pipe(bump({ type: type }))
.pipe(gulp.dest('./'));
};
}
gulp.task('bump', getBumpTask('patch'));
gulp.task('bump:minor', getBumpTask('minor'));
gulp.task('bump:major', getBumpTask('major'));
/**
* Git tag task
* (version *must* be bumped first)
*/
gulp.task('publish:tag', function (done) {
var pkg = require('./package.json');
var v = 'v' + pkg.version;
var message = 'Release ' + v;
git.tag(v, message, function (err) {
if (err) throw err;
git.push('origin', v, function (err) {
if (err) throw err;
done();
});
});
});
/**
* npm publish task
* * (version *must* be bumped first)
*/
gulp.task('publish:npm', function (done) {
require('child_process')
.spawn('npm', ['publish'], { stdio: 'inherit' })
.on('close', done);
});
/**
* Deploy tasks
*/
gulp.task('release', ['publish:tag', 'publish:npm']);