Create a gist now

Instantly share code, notes, and snippets.

@goodguyry /post-receive Secret
Created Dec 30, 2014

Embed
What would you like to do?
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