@@ -11,6 +11,10 @@ var del = require('del');
11
11
var size = require ( 'gulp-filesize' ) ;
12
12
var usemin = require ( 'gulp-usemin' ) ;
13
13
var rev = require ( 'gulp-rev' ) ;
14
+ var git = require ( 'gulp-git' ) ;
15
+ var bump = require ( 'gulp-bump' ) ;
16
+ var filter = require ( 'gulp-filter' ) ;
17
+ var tag_version = require ( 'gulp-tag-version' ) ;
14
18
15
19
gulp . task ( 'default' , [ 'build' , 'templates' ] , function ( ) {
16
20
@@ -91,3 +95,37 @@ gulp.task('build',['templates'], function(){
91
95
. pipe ( size ( ) )
92
96
. pipe ( gulp . dest ( 'dist/' ) ) ;
93
97
} ) ;
98
+
99
+
100
+ /**
101
+ * Bumping version number and tagging the repository with it.
102
+ * Please read http://semver.org/
103
+ *
104
+ * You can use the commands
105
+ *
106
+ * gulp patch # makes v0.1.0 → v0.1.1
107
+ * gulp feature # makes v0.1.1 → v0.2.0
108
+ * gulp release # makes v0.2.1 → v1.0.0
109
+ *
110
+ * To bump the version numbers accordingly after you did a patch,
111
+ * introduced a feature or made a backwards-incompatible release.
112
+ */
113
+
114
+ function inc ( importance ) {
115
+ // get all the files to bump version in
116
+ return gulp . src ( [ './manifest.json' , './package.json' , './bower.json' ] )
117
+ // bump the version number in those files
118
+ . pipe ( bump ( { type : importance } ) )
119
+ // save it back to filesystem
120
+ . pipe ( gulp . dest ( './' ) )
121
+ // commit the changed version number
122
+ . pipe ( git . commit ( 'bumps package version' ) )
123
+ // read only one file to get the version number
124
+ . pipe ( filter ( 'manifest.json' ) )
125
+ // **tag it in the repository**
126
+ . pipe ( tag_version ( ) ) ;
127
+ }
128
+
129
+ gulp . task ( 'patch' , function ( ) { return inc ( 'patch' ) ; } )
130
+ gulp . task ( 'feature' , function ( ) { return inc ( 'minor' ) ; } )
131
+ gulp . task ( 'release' , function ( ) { return inc ( 'major' ) ; } )
0 commit comments