Skip to content

Instantly share code, notes, and snippets.

@halhenke
Created December 9, 2014 08:38
Show Gist options
  • Save halhenke/4c26e9263a5c57e05836 to your computer and use it in GitHub Desktop.
Save halhenke/4c26e9263a5c57e05836 to your computer and use it in GitHub Desktop.
Simple code deploy by visiting a URL with connect-githubhook module
var express = require('express'),
cgh = require('connect-githubhook'),
sites = {'/secret-update-url': {url: 'https://github.com/user/repo',
branch: 'master'},
app = express.createServer();
var handler = function(repo, payload) {
console.log('Code change detected. Restarting now...');
setTimeout(function() {
process.exit(1);
}, 1000);
};
app.use(express.bodyParser()); //required
app.use(cgh(sites, handler));
app.listen(8000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment