Created
August 5, 2012 17:14
-
-
Save alanorozco/3266068 to your computer and use it in GitHub Desktop.
Jekyll deployment Git post-receive hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Include .htaccess in the server-specific assets to be copied | |
GLOBIGNORE=. | |
REPONAME='aocontent' | |
PATH=$PATH:/home/private/gems/bin | |
GIT_REPO=$HOME/git/$REPONAME.git | |
TMP_GIT_CLONE=$HOME/tmp_deploy/$REPONAME | |
BUILD_DEFAULT=/home/private/build/default | |
BUILD=/home/private/build/build | |
LESS_ROOT=$BUILD/a/css/screen.less | |
PUBLIC_WWW=/home/public | |
export GEM_HOME=/home/private/gems | |
git clone $GIT_REPO $TMP_GIT_CLONE | |
jekyll --no-auto $TMP_GIT_CLONE $BUILD | |
echo "Compiling LESS..." | |
php /home/private/lessphp/plessc -f=compressed $LESS_ROOT ${LESS_ROOT%.*}.css | |
find $BUILD -type f -name "*.less" -exec rm -f {} \; | |
echo "done." | |
# merge default and build | |
cp -R $BUILD_DEFAULT/* $BUILD | |
rm -Rf $TMP_GIT_CLONE | |
echo "gzipping..." | |
find -L $BUILD -type f \ | |
-name "*.html" \ | |
-o -name "*.css" \ | |
-o -name "*.js" \ | |
-o -name "*.xml" \ | |
| while read FNAME; do | |
gzip -c -9 "$FNAME" > "${FNAME}.gz" | |
done | |
echo "done." | |
echo "Copying to public directory and removing build directory..." | |
rsync -rtz --delete $BUILD/ $PUBLIC_WWW/ | |
rm -Rf $BUILD | |
echo "done." | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment