Select Git revision
Gruntfile.js
Gruntfile.js 19.75 KiB
'use strict';
module.exports = function(grunt) {
grunt.registerTask('default', [
'clean',
'bower',
'bower_concat',
'copy',
'uglify',
'sass',
'cssmin',
'jshint',
'mocha'
]);
grunt.registerTask('travis', 'Alias for "jshint", "mocha" tasks.', function(update) {
if (!update) {
grunt.task.run([
'jshint',
'mocha'
]);
} else {
if (process.env.TRAVIS) {
grunt.log.writeln('Running grunt and updating translations...'.magenta);
grunt.task.run([
// 'exec:git:checkout:master', // should be on 'master' branch
'default', // Run default task
'update_trans', // Update translations
'exec:commit_changed_files:yes', // Determine what we need to commit if needed, stop if nothing to commit.
'exec:git:"reset --hard"', // Reset unstaged changes (to allow for a rebase)
'exec:git:checkout:develop', 'exec:git:rebase:master', // FF develop to the updated master
'exec:git_push:origin:"master develop"' // Push master and develop
]);
} else {
grunt.fatal('This task is only for Travis-CI!');
}
}
});
grunt.registerTask('update_trans', 'Update translations', function() {
grunt.log.writeln('Updating translations...'.magenta);
var tasks = [
'exec:babel_extract',
'exec:babel_update',
// + crowdin
'exec:babel_compile',
'po2json'
];
if (process.env.CROWDIN_API_KEY) {
tasks.splice(2, 0, 'exec:crowdin_upload', 'exec:crowdin_download'); // insert items at index 2
} else {
grunt.log.warn('Environment variable `CROWDIN_API_KEY` is not set, not syncing with Crowdin.'.bold);
}
grunt.task.run(tasks);
});
/****************************************
* Admin only tasks *
****************************************/
grunt.registerTask('publish', 'ADMIN: Create a new release tag and generate new CHANGES.md', [
'travis',
'newrelease', // Pull and merge develop to master, create and push a new release
'genchanges' // Update CHANGES.md
]);
grunt.registerTask('newrelease', "Pull and merge develop to master, create and push a new release", [
'exec:git:checkout:develop', 'exec:git:pull', // Pull develop
'exec:git:checkout:master', 'exec:git:pull', // Pull master
'exec:git:merge:develop', // Merge develop into master