Skip to content

Instantly share code, notes, and snippets.

@xxzefgh
Created October 25, 2016 17:06
Show Gist options
  • Save xxzefgh/58578ea25cc4b0ce2e56b7e5c240953f to your computer and use it in GitHub Desktop.
Save xxzefgh/58578ea25cc4b0ce2e56b7e5c240953f to your computer and use it in GitHub Desktop.
#!/bin/bash
app_path="/path/to/target/folder"
if [ ! -d $app_path ]; then
mkdir -p $app_path;
fi
while read oldrev newrev ref
do
if [[ $ref =~ .*/master$ ]];
then
echo "Master ref received. Deploying master branch to production..."
git --work-tree=$app_path --git-dir=./ checkout -f
# Put your deployment script here
else
echo "Ref $ref successfully received. Doing nothing: only the master 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