Created
August 24, 2019 01:00
-
-
Save skorotkiewicz/b2e4cbb275d9f25454d8b3d434d8d2d9 to your computer and use it in GitHub Desktop.
Automating the development of NodeJS Apps with Git post-update
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
#!/bin/bash -l | |
GIT_REPO=/home/node/project | |
GIT_CLONE=/home/node/project_public | |
function prepare { | |
cd $GIT_CLONE || exit | |
forever stop myapp > /dev/null 2>&1 | |
unset GIT_DIR | |
git pull origin | |
npm install | |
node ./node_modules/gulp/bin/gulp.js | |
sed -i 's#http://localhost:3000#https://example.com#g' views/chat.html | |
sed -i 's/dev/production/g' database.config.js | |
forever start -a --uid myapp app.js | |
} | |
if [ ! -d "$GIT_CLONE" ]; then | |
git clone $GIT_REPO $GIT_CLONE | |
prepare | |
else | |
prepare | |
fi | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment