Skip to content

Instantly share code, notes, and snippets.

@galbus
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save galbus/ed3d46424f8c2c3206c0 to your computer and use it in GitHub Desktop.

Select an option

Save galbus/ed3d46424f8c2c3206c0 to your computer and use it in GitHub Desktop.
Grunt file snippet for buildcontrol: automated deployment using Git
/**
* The following buildcontrol config will commit the built
* files into a Git repo on our staging/production server.
*
* The repos have a post-update hook that updates the code
* in the document root.
*/
module.exports = function (grunt) {
// ...
grunt.initConfig({
// ...
/**
* Buildcontrol settings
*
* @see https://blog.5apps.com/2014/05/29/deploying-static-apps-with-grunt-build-control-on-5apps-deploy.html
* @see http://git-scm.com/book/en/Git-on-the-Server-Setting-Up-the-Server
*/
buildcontrol: {
options: {
dir: 'dist',
commit: true,
push: true,
message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
},
development: {
options: {
remote: 'git@example.com:/git/example-development.git',
branch: 'master'
}
},
production: {
options: {
remote: 'git@example.com:/git/example-production.git',
branch: 'master',
tag: pkg.version
}
},
local: {
options: {
remote: '../',
branch: 'build'
}
}
}
// ...
});
// ...
/**
* Register 'grunt deploy' to build and then deploy
*/
grunt.registerTask('deploy', function (environment) {
grunt.task.run([
'build',
'buildcontrol:' + environment
]);
});
// ...
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment