Skip to content

Commit

Permalink
[BUGFIX] beef up error checking on release
Browse files Browse the repository at this point in the history
  • Loading branch information
brousalis committed Jul 17, 2016
1 parent a1ee826 commit 82ddb9b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gulpfile.js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ var settings = {
]
},

github: { // Options for github release
release: { // Options for github release
upstream: 'origin', // The "upstream" branch to fetch changes from
branch: 'master', // Which branch to push the created release and tags to
},
Expand Down
16 changes: 11 additions & 5 deletions gulpfile.js/tasks/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ gulp.task('bump', function(callback) {

// Fetches tags
gulp.task('fetch', function(callback) {
git.fetch(config.github.upstream, '', {quiet: true}, callback);
git.fetch(config.release.upstream, '', {quiet: true}, callback);
});

// Commits the manifest with the bumped version number
Expand All @@ -58,7 +58,7 @@ gulp.task('commit', function(callback) {
gulp.task('push', function (callback) {
util.log(gutil.colors.yellow('Pushing version bump to ' + manifest.version()));

git.push(config.github.upstream, config.github.branch, callback);
git.push(config.release.upstream, config.release.branch, callback);
});

// Takes the zip'd up build folder and posts it to a GitHub release
Expand All @@ -71,8 +71,9 @@ gulp.task('github-release', function(callback) {

var dest = config.paths.build;

if (config.build.archive)
if (config.build.archive) {
dest = path.join(config.paths.build, config.build.archiveName)
}

return gulp.src(dest)
.pipe(githubRelease({
Expand All @@ -88,12 +89,17 @@ gulp.task('github-release', function(callback) {
function release(callback) {
if (process.env.GITHUB_TOKEN === '' ||
process.env.GITHUB_TOKEN === undefined) {
util.errorHandler('deploy')(new Error('Missing GITHUB_TOKEN environment variable'));
util.errorHandler('release')(new Error('Missing GITHUB_TOKEN environment variable.'));
return false;
}

if (!util.fileExists(config.paths.build)) {
util.errorHandler('deploy')(new Error('You need to build the application first. Run `gulp build`'));
util.errorHandler('release')(new Error('You need to build the application first. Run `gulp build`.'));
return;
}

if (!manifest.repo()) {
util.errorHandler('release')(new Error('You need to fix your `package.json` url and repo fields.'));
return;
}

Expand Down

0 comments on commit 82ddb9b

Please sign in to comment.