paper.js/gulp/tasks/publish.js

64 lines
1.8 KiB
JavaScript
Raw Normal View History

2016-01-31 08:30:14 -05:00
/*
* Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
* http://paperjs.org/
*
* Copyright (c) 2011 - 2016, Juerg Lehni & Jonathan Puckey
* http://scratchdisk.com/ & http://jonathanpuckey.com/
*
* Distributed under the MIT license. See LICENSE file for details.
*
* All rights reserved.
*/
var gulp = require('gulp'),
bump = require('gulp-bump'),
git = require('gulp-git-streamed'),
run = require('run-sequence'),
2016-01-31 08:30:14 -05:00
shell = require('gulp-shell'),
options = require('../utils/options.js')({ suffix: false });
gulp.task('publish', function() {
if (options.branch !== 'develop') {
throw new Error('Publishing is only allowed on the develop branch.');
}
return run(
'publish:bump',
'publish:dist',
'publish:commit',
'publish:release',
'publish:load'
);
});
2016-01-31 08:30:14 -05:00
gulp.task('publish:bump', function() {
return gulp.src([ 'package.json', 'component.json' ])
.pipe(bump({ version: options.version }))
.pipe(gulp.dest('.'));
2016-01-31 08:30:14 -05:00
});
gulp.task('publish:dist', ['dist']);
gulp.task('publish:commit', function() {
2016-01-31 08:30:14 -05:00
var message = 'Release version ' + options.version;
return gulp.src('.')
.pipe(git.add())
2016-01-31 08:30:14 -05:00
.pipe(git.commit(message))
.pipe(git.tag('v' + options.version, message));
});
gulp.task('publish:release', function() {
return gulp.src('.')
2016-01-31 08:30:14 -05:00
.pipe(git.checkout('master'))
.pipe(git.merge('develop', { args: '-X theirs' }))
.pipe(git.push('origin', ['master', 'develop'], { args: '--tags' }))
2016-01-31 08:30:14 -05:00
.pipe(shell('npm publish'))
.pipe(git.checkout('develop'));
});
gulp.task('publish:load', ['load'], function() {
return gulp.src('dist')
.pipe(git.add())
.pipe(git.commit('Switch back to load.js versions for development.'))
.pipe(git.push('origin', 'develop'));
});