Created
December 9, 2014 08:38
-
-
Save halhenke/4c26e9263a5c57e05836 to your computer and use it in GitHub Desktop.
Simple code deploy by visiting a URL with connect-githubhook module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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