Reputation: 6901
As part of my grunt:build command, I run a shell task that builds my jekyll site, commits the project, and pushes it to github. The only problem is the commit message. I'd love to be able to call grunt:build and also pass in a string which will become my commit message. But I'm not really sure how to make that work. Any thoughts?
Here are the relevant parts of my Gruntfile:
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
shell: {
dev: {
command: 'jekyll build'
},
build: {
command: [
'jekyll build',
'git commit -am "test commit"',
'git push origin master'
].join('&&')
}
}
grunt.loadNpmTasks('grunt-shell');
grunt.registerTask('build', ['jshint','concat', 'uglify','sass', 'autoprefixer','shell:build']);
};
Upvotes: 2
Views: 2536
Reputation: 13762
Try grunt.option()
(http://gruntjs.com/api/grunt.option):
'git commit -am "' + grunt.option('commit-msg') + '"',
and running with: grunt build --commit-msg="test commit"
Upvotes: 5