Created
May 23, 2014 17:12
-
-
Save adriano-di-giovanni/11c648c82a29ab4f16e3 to your computer and use it in GitHub Desktop.
Automated Node.js application deployment using git and nvm
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
#!/usr/bin/env sh | |
set -e | |
read sha1_old sha1_new refname | |
WORK_TREE=/srv/admin/apps/si-mysql-maint | |
NVM="${HOME}/.nvm/nvm.sh" | |
mkdir -p ${WORK_TREE} | |
git --work-tree=${WORK_TREE} clean -fd | |
git --work-tree=${WORK_TREE} checkout ${sha1_new} --force | |
if [ -s ${NVM} ]; then | |
cd ${WORK_TREE} | |
NVM_DIR=`dirname ${NVM}` | |
export NVM_DIR | |
. ${NVM} | |
npm install | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Specifying
${sha1_new}
togit checkout
lets you checkout branches and tags.Don't know why I couldn't find this solution reported. It works. Any downside?