Skip to content

Instantly share code, notes, and snippets.

@twitchy
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twitchy/8876991 to your computer and use it in GitHub Desktop.
Save twitchy/8876991 to your computer and use it in GitHub Desktop.
grunt-build-control
// GRUNT-BUILD-CONTROL
// https://npmjs.org/package/grunt-build-control
// http://curtisblackwell.com/blog/my-deploy-method-brings-most-of-the-boys-to-the-yard
//
// use grunt to auto push /dist to live, stage, whatever on build
//
- npm install grunt-build-control --save-dev
- // grunt.loadNpmTasks('grunt-build-control'); ( not needed with yeoman )
- configuration:
// Project configuration.
grunt.initConfig({
// Various Grunt tasks...
buildcontrol: {
options: {
dir: 'dist',
commit: true,
push: true,
message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
},
pages: {
options: {
remote: 'git@github.com:example_user/example_webapp.git',
branch: 'gh-pages'
}
},
heroku: {
options: {
remote: 'git@heroku.com:example-heroku-webapp-1988.git',
branch: 'master'
}
},
myServer: {
options: {
remote: '{{ myServer }}',
branch: 'master'
}
},
local: {
options: {
remote: '../',
branch: 'build'
}
}
}
});
grunt.registerTask('deploy', [
// Collection of tasks that build code to the 'dist' directory...
buildcontrol:myServer
]);
// Add post-receive hook to output /dist on live
// hooks/post-receive
// path to site = /home/.../.../public_html/
GIT_WORK_TREE=/path/to/site git checkout -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment