Last active
August 2, 2016 00:19
-
-
Save brcolow/6a52b981d155600b1ffcdf07a6087379 to your computer and use it in GitHub Desktop.
post-receive
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 | |
command_exists() { | |
declare -Ff "$1" >/dev/null; | |
} | |
error_exit() { | |
echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2 | |
exit 1 | |
} | |
unset GIT_DIR | |
PROGNAME=$(basename "$0") | |
GIT_REPO=$HOME/repo/cryptodash | |
STAGING=$HOME/staging | |
PUBLIC_WWW=/var/www | |
if [ ! -d "$STAGING"/cryptodash ]; then | |
mkdir "${STAGING}" | |
cd "${STAGING}" | |
git clone "$GIT_REPO" | |
cd "${STAGING}"/cryptodash | |
fi | |
git fetch origin | |
git reset --hard origin/master | |
git clean -f -d | |
npm install --save-dev | |
gulp --production | |
find ${PUBLIC_WWW} -mindepth 1 -delete | |
cp -avr "${STAGING}"/cryptodash/build/. ${PUBLIC_WWW} | |
cp post-receive "${GIT_REPO}"/hooks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment