Skip to content

Commit

Permalink
feat: add automated bump parser based on commit messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaixhin committed Oct 14, 2015
1 parent e4f58b6 commit 58b1493
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
16 changes: 9 additions & 7 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ var git = require("gulp-git");
var bump = require("gulp-bump");
var conventionalChangelog = require("gulp-conventional-changelog");
var conventionalGithubReleaser = require("conventional-github-releaser");
var conventionalRecommendedBump = require("conventional-recommended-bump");

// Load CONVENTIONAL_GITHUB_RELEASER_TOKEN from .env
require("dotenv").config({silent: true});
// Use --bump=<type> for a major/minor release
var options = parseArgs(process.argv.slice(2), {string: ["bump", "github_token"], default: {bump: "patch", github_token: process.env.CONVENTIONAL_GITHUB_RELEASER_TOKEN}});
var options = parseArgs(process.argv.slice(2), {string: ["github_token"], default: {github_token: process.env.CONVENTIONAL_GITHUB_RELEASER_TOKEN}});

// Changelogs use AngularJS convention (https://github.com/ajoslin/conventional-changelog/blob/master/conventions/angular.md)
gulp.task("changelog", function() {
Expand All @@ -22,16 +22,18 @@ gulp.task("changelog", function() {
.pipe(gulp.dest("./"));
});

gulp.task("github-release", function(done) {
conventionalGithubReleaser({type: "oauth", token: options.github_token}, {preset: "angular"}, done);
gulp.task("github-release", function(cb) {
conventionalGithubReleaser({type: "oauth", token: options.github_token}, {preset: "angular"}, cb);
});

// Abides by semantic versioning rules (http://semver.org/)
gulp.task("bump-version", function() {
// Valid bump types are major|minor|patch|prerelease
return gulp.src(["./bower.json", "./package.json"])
.pipe(bump({type: options.bump}).on("error", gutil.log))
.pipe(gulp.dest("./"));
conventionalRecommendedBump({preset: "angular"}, function(err, releaseAs) {
return gulp.src(["./bower.json", "./package.json"])
.pipe(bump({type: releaseAs}).on("error", gutil.log))
.pipe(gulp.dest("./"));
});
});

gulp.task("commit-changes", function() {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
},
"devDependencies": {
"conventional-github-releaser": "^0.5.0",
"conventional-recommended-bump": "0.0.3",
"gulp": "^3.9.0",
"gulp-bump": "^1.0.0",
"gulp-conventional-changelog": "^0.7.0",
Expand Down

0 comments on commit 58b1493

Please sign in to comment.