Skip to content

Commit 1563cdb

Browse files
author
Shuwen Qian
committed
Use gulp-git to tag
1 parent 78d3656 commit 1563cdb

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

Gulpfile.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,13 @@ gulp.task('watch', function () {
172172
/** DEPLOY **/
173173

174174
gulp.task('release:major', function() {
175-
run('build:prod', 'bump:major', 'changelog', 'stage-release');
175+
run('build:prod', 'bump:major', 'changelog', 'stage-release', 'tag-release');
176176
});
177177
gulp.task('release:minor', function() {
178-
run('build:prod', 'bump:minor', 'changelog', 'stage-release');
178+
run('build:prod', 'bump:minor', 'changelog', 'stage-release', 'tag-release');
179179
});
180180
gulp.task('release:patch', function() {
181-
run('build:prod', 'bump:patch', 'changelog', 'stage-release');
181+
run('build:prod', 'bump:patch', 'changelog', 'stage-release', 'tag-release');
182182
});
183183

184184
gulp.task('bump:major', function(){
@@ -211,10 +211,20 @@ gulp.task('changelog', function() {
211211
.pipe(gulp.dest('.'));
212212
});
213213

214+
function getPkgInfo() {
215+
return JSON.parse(fs.readFileSync('package.json', 'utf8'));
216+
}
217+
214218
gulp.task('stage-release', function() {
215-
var pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
219+
var pkg = getPkgInfo();
216220
return gulp.src([DIST, 'package.json', 'bower.json', 'CHANGELOG.md'])
217221
.pipe(git.add())
218-
.pipe(git.commit('Release v'+pkg.version))
219-
.pipe(tagVersion());
222+
.pipe(git.commit('Release v'+pkg.version));
223+
});
224+
225+
gulp.task('tag-release', function() {
226+
var pkg = getPkgInfo();
227+
git.tag('v'+pkg.version, 'Version '+pkg.version, function(err) {
228+
console.log(err);
229+
});
220230
});

0 commit comments

Comments
 (0)