Created
January 10, 2016 19:12
-
-
Save xperienced/46498b004b5e0003c299 to your computer and use it in GitHub Desktop.
GIT update hook for git push to deploy
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 | |
readonly APP_NAME=test_app | |
readonly GIT_WORK_TREE=~/apps/$APP_NAME | |
declare REF_NAME=$1 COMMIT_HASH=$3 | |
if [[ "$REF_NAME" == "refs/heads/master" ]]; then | |
echo "Master branch updated. Deploying to production." | |
mkdir -p $GIT_WORK_TREE | |
git --work-tree=$GIT_WORK_TREE checkout -f $COMMIT_HASH | |
else | |
echo "Pushing to branch other than master. Deployment is done only when pushing to master branch." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment