Skip to content

Instantly share code, notes, and snippets.

@sjoerd-dijkstra
Last active July 23, 2019 19:57
Show Gist options
  • Save sjoerd-dijkstra/f561f3fcdef6517d579bd86a085e4bee to your computer and use it in GitHub Desktop.
Save sjoerd-dijkstra/f561f3fcdef6517d579bd86a085e4bee to your computer and use it in GitHub Desktop.
#!/bin/bash
TARGET=/home/pi/websites
GIT_DIR=/home/pi/websites.git/
BRANCH=master
while read oldrev newrev ref
do
# only checking out the master (or whatever branch you would like to deploy)
if [ "$ref" = "refs/heads/$BRANCH" ];
then
toilet -f bigascii12 deploy..
echo "Ref $ref received. Deploying ${BRANCH} branch to production..."
echo
git --work-tree=$TARGET --git-dir=$GIT_DIR checkout -f $BRANCH
else
echo "Ref $ref received. Doing nothing: only the ${BRANCH} branch may be deployed on this server."
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment