Skip to content

Instantly share code, notes, and snippets.

@skorotkiewicz
Created August 24, 2019 01:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skorotkiewicz/b2e4cbb275d9f25454d8b3d434d8d2d9 to your computer and use it in GitHub Desktop.
Save skorotkiewicz/b2e4cbb275d9f25454d8b3d434d8d2d9 to your computer and use it in GitHub Desktop.
Automating the development of NodeJS Apps with Git post-update
#!/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