Skip to content

Instantly share code, notes, and snippets.

@DaMandal0rian
Last active April 9, 2018 11:46
Show Gist options
  • Save DaMandal0rian/a6e308cd905b7a4e5b130c4161cb89da to your computer and use it in GitHub Desktop.
Save DaMandal0rian/a6e308cd905b7a4e5b130c4161cb89da to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
unset GIT_WORK_TREE
export GIT_WORK_TREE="/var/www/example.com"
export NODE_VERSION="8.9.3"
export NODE_ENV=production
# export NODE_PATH=/home/motif/bin/node
echo "--> Checking out..."
git --work-tree=$GIT_WORK_TREE --git-dir=/var/repos/myrepo.git checkout -f master
echo "--> Selecting Node version $NODE_VERSION"
. $HOME/.nvm/nvm.sh
nvm use $NODE_VERSION
echo "--> Installing libraries..."
cd "$GIT_WORK_TREE"
npm install
gulp
echo "--> Restart server..."
pm2 restart {appname}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment