Skip to content

Commit 1914a97

Browse files
author
Shuwen Qian
committed
Add changelog generation task
1 parent 6984446 commit 1914a97

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

Gulpfile.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ var postcss = require('gulp-postcss');
2525
var autoprefixer = require('autoprefixer');
2626
var git = require('gulp-git');
2727
var bump = require('gulp-bump');
28-
var tag_version = require('gulp-tag-version');
28+
var tagVersion = require('gulp-tag-version');
29+
var conventionalChangelog = require('gulp-conventional-changelog');
2930

3031
var SRC = 'src/';
3132
var BUILD = 'build/';
@@ -170,6 +171,16 @@ gulp.task('watch', function () {
170171

171172
/** DEPLOY **/
172173

174+
gulp.task('release:major', function() {
175+
run('build:prod', 'bump:major', 'changelog', 'stage-release');
176+
});
177+
gulp.task('release:minor', function() {
178+
run('build:prod', 'bump:minor', 'changelog', 'stage-release');
179+
});
180+
gulp.task('release:patch', function() {
181+
run('build:prod', 'bump:patch', 'changelog', 'stage-release');
182+
});
183+
173184
gulp.task('bump:major', function(){
174185
return gulp.src(['package.json', 'bower.json'])
175186
.pipe(bump({type: 'major'}))
@@ -186,6 +197,20 @@ gulp.task('bump:patch', function(){
186197
.pipe(gulp.dest('./'));
187198
});
188199

200+
gulp.task('changelog', function() {
201+
return gulp.src('CHANGELOG.md')
202+
.pipe(conventionalChangelog({
203+
pkg: {
204+
transform: function(pkg) {
205+
pkg.version = 'v'+pkg.version;
206+
return pkg;
207+
}
208+
}
209+
}))
210+
.pipe(debug())
211+
.pipe(gulp.dest('.'));
212+
});
213+
189214
gulp.task('stage-release', function() {
190215
var pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
191216
return gulp.src([DIST, 'package.json', 'bower.json', 'CHANGELOG.md'])

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"gulp-bump": "^1.0.0",
4141
"gulp-cached": "^1.1.0",
4242
"gulp-changed": "^1.3.0",
43+
"gulp-conventional-changelog": "^1.0.1",
4344
"gulp-debug": "^2.1.2",
4445
"gulp-git": "^1.7.0",
4546
"gulp-inline-assets": "^0.1.1",

0 commit comments

Comments
 (0)