Skip to content

Instantly share code, notes, and snippets.

@hssrrw
hssrrw / deploy.js
Last active July 11, 2016 13:26
Simple express server listening to github webhooks. Deployes production when PR merged to master. I use pm2 to manage node apps. There's no error catching by now.
const fs = require('fs');
const path = require('path');
const spawn = require('child_process').spawn;
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
const log = (msg) => {
console.log(msg);
fs.appendFile(path.join(__dirname, 'deploy.log'), `${msg}\n`, (err) => {