Skip to content

Instantly share code, notes, and snippets.

@kaezarrex
Created February 13, 2014 01:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaezarrex/8967917 to your computer and use it in GitHub Desktop.
Save kaezarrex/8967917 to your computer and use it in GitHub Desktop.
post-receive deploy hook
#!/bin/bash
build="build-branch"
build_dir="/build/path"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ "$build" == "$branch" ]; then
GIT_WORK_TREE=$build_dir git checkout -f $build
cd $build_dir
# run build command(s) here
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment