Skip to content

Instantly share code, notes, and snippets.

@goodguyry
Created December 30, 2014 07:19
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 goodguyry/60661091c2bb68d9574c to your computer and use it in GitHub Desktop.
Save goodguyry/60661091c2bb68d9574c to your computer and use it in GitHub Desktop.
Git Post-Receive Hook
#!/bin/bash
# Source/PATH to match login shell
source $HOME/.rvm/scripts/rvm
PATH="$PATH:$HOME/.nvm/v0.10.35/bin"
PATH="$PATH:$HOME/.rvm/bin"
# Variables
WORK_TREE=$HOME/path/to/working-tree
REPO_DIR=$HOME/path/to/bare-repo.git
PRODUCTION_ROOT=$HOME/path/to/live-root
echo "post-receive running.."
git --work-tree=$WORK_TREE --git-dir=$REPO_DIR checkout -f
cd $WORK_TREE
# Set Sass style to compressed
grunt environment:prod
# Build
jekyll build --destination $PRODUCTION_ROOT
# Set Sass style back to expanded
grunt environment:dev
echo "post-receive done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment