Skip to content

Instantly share code, notes, and snippets.

@Foxandxss
Created January 26, 2014 12:30
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 Foxandxss/8632043 to your computer and use it in GitHub Desktop.
Save Foxandxss/8632043 to your computer and use it in GitHub Desktop.
My Lineman post-receive hook
#!/bin/sh
read oldrev newrev refname
LOGFILE=./post-receive.log
DEPLOYDIR=/var/www/lineman/project
echo -e "Received Push Request a $( date +%F )" >> $LOGFILE
echo " - Old SHA: $oldrev New SHA: $newrev Branch Name: $refname" >> $LOGFILE
echo "Starting Deploy" >> $LOGFILE
echo " - Starting code update"
GIT_WORK_TREE="$DEPLOYDIR" git checkout -f
echo " - Finished code update"
echo "Building the app"
echo " - Installing dependencies"
cd "$DEPLOYDIR"; npm install
echo " - Lineman build"
lineman build
echo " - Moving the files"
rsync -avP --delete dist/ ../www
echo " - Cleaning the repo"
lineman clean
echo "Finished build"
echo "Finished Deploy" >> $LOGFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment