Created
August 20, 2018 16:49
-
-
Save calderaro/8026875b9fb92a69d9e9ea6a5b520836 to your computer and use it in GitHub Desktop.
deploy over http
This file contains hidden or 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
const {exec} = require('child_process') | |
export default function runDeploy () { | |
return new Promise((resolve, reject) => { | |
exec('git pull origin master', (err, stdout1, stderr) => { | |
if (err) return reject(stderr) | |
exec('npm run update', (err, stdout2, stderr) => { | |
if (err) return reject(stderr) | |
return resolve([stdout1, stdout2]) | |
}) | |
}) | |
}) | |
} |
This file contains hidden or 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
app | |
.post('/deploy', (req, res, next) => { | |
if (!props.deploy) return next() | |
props.deploy() | |
.then(response => res.json(response)) | |
.catch(err => res.status(500).json(err)) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment