diff --git a/Gruntfile.js b/Gruntfile.js index 9a3fb67..978dc7d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -190,6 +190,37 @@ module.exports = function (grunt) { ], tasks: ['jshint:test_unit', 'karma:unit:run'] } + }, + + deploy: { + options: { + versionFiles: [ + 'package.json', + 'bower.json' + ], + preDeployFn: function (grunt, newVersion, done) { + // Needed to make uglify use the banner with the new version inside + grunt.config.set('pkg', grunt.file.readJSON('package.json')); + + grunt.task.run([ + 'build', + 'changelog' + ]); + done(); + }, + postDeployFn: function (grunt, newVersion, done) { + if (!grunt.option('soft')) { + var exec = require('child_process').exec; + exec('npm publish', null, function (err, stdout) { + console.log(stdout); + done(); + }); + } + else { + done(); + } + } + } } }); diff --git a/package.json b/package.json index f1747bb..3e5db47 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,8 @@ "sofa-testing": "~0.1.x", "karma-jasmine": "~0.1.5", "karma-chrome-launcher": "~0.1.2", - "karma-firefox-launcher": "~0.1.3" + "karma-firefox-launcher": "~0.1.3", + "grunt-deploy-semver": "^0.3.0" }, "dependencies": { "sofa-core": "0.4.x"