Created
March 30, 2015 19:06
-
-
Save seveas/35a86ee2b0ba7a9ad24c to your computer and use it in GitHub Desktop.
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
[dkaarsemaker@blog-001 ~]$ cat /srv/blog/blog.git/hooks/post-receive | |
#!/bin/bash | |
BLOG_PATH="/srv/blog"; | |
REPO_PATH="${BLOG_PATH}/blog.git/"; | |
WWW_PATH="${BLOG_PATH}/current"; | |
CURRENT_SHA1=`cat ${REPO_PATH}/refs/heads/master`; | |
PUBLISH_DIR="${BLOG_PATH}/${CURRENT_SHA1}"; | |
WORK_DIR="${PUBLISH_DIR}_workdir" | |
mkdir ${WORK_DIR}; | |
git --git-dir=${REPO_PATH} --work-tree=${WORK_DIR} checkout -f master | |
cp -a "${WORK_DIR}/output" ${PUBLISH_DIR} | |
ln -snf ${PUBLISH_DIR} ${WWW_PATH} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment