-
-
Save todgru/2f1f559c5bbb5892ac90f0d464aa4982 to your computer and use it in GitHub Desktop.
Super simple git post-receive hook for Node.js + nvm + npm + node-foreman + init (Ubuntu) deployment
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
#!/usr/bin/env bash | |
set -u | |
set -e | |
export GIT_WORK_TREE="/var/www/example.com" | |
export NODE_VERSION="0.10" | |
echo "--> Checking out..." | |
git checkout -f | |
echo "--> Selecting Node version $NODE_VERSION" | |
. $HOME/.nvm/nvm.sh | |
nvm use $NODE_VERSION | |
echo "--> Installing libraries..." | |
cd "$GIT_WORK_TREE" | |
npm install | |
echo "--> Exporting Foreman files..." | |
node_modules/.bin/nf export -o /etc/init | |
echo "--> Restarting..." | |
stop foreman | |
start foreman |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment