diff options
author | Alexander Sulfrian <alex@spline.inf.fu-berlin.de> | 2012-07-26 16:02:19 +0200 |
---|---|---|
committer | wartung <wartung@vm-staticweb.spline.inf.fu-berlin.de> | 2012-07-26 16:02:19 +0200 |
commit | 0fd1a0306cd025fc16785dad8f2e208b9d60cb29 (patch) | |
tree | 636d400359f0d62cda9dcd533ffcce67ee729139 /post-receive.cyrax-build | |
download | hooks-0fd1a0306cd025fc16785dad8f2e208b9d60cb29.tar.gz hooks-0fd1a0306cd025fc16785dad8f2e208b9d60cb29.tar.bz2 hooks-0fd1a0306cd025fc16785dad8f2e208b9d60cb29.zip |
initial commit
Diffstat (limited to 'post-receive.cyrax-build')
-rwxr-xr-x | post-receive.cyrax-build | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/post-receive.cyrax-build b/post-receive.cyrax-build new file mode 100755 index 0000000..a564c79 --- /dev/null +++ b/post-receive.cyrax-build @@ -0,0 +1,39 @@ +#/bin/bash + +WEB_BASE="/var/www/" + +while read old new ref ; do + BRANCH="${ref#refs/heads/}" + + if [ "$BRANCH" = "master" ]; then + TARGET_DIR="${WEB_BASE}/www.spline.de/htdocs/" + URL="http://www.spline.de/" + else + TARGET_DIR="${WEB_BASE}/branches.spline.de/htdocs/" + URL="http://branches.spline.de/${BRANCH}/" + fi + + + if [ "${new}" = "0000000000000000000000000000000000000000" ]; then + rm -rf "${TARGET_DIR}" + exit 0 + fi + + TMP_DIR=$(mktemp -d) + git archive "${BRANCH}" | tar -C "${TMP_DIR}" -xf - >/dev/null 2>&1 + + # customize url in settings.cfg + test "${BRANCH}" = "master" || sed -i "s%^url: .*$%url: ${URL}%" "${TMP_DIR}/settings.cfg" + + # build website + . /home/wartung/cyrax_env/bin/activate + mkdir -p "${TARGET_DIR}" + cyrax -q -d ${TARGET_DIR} ${TMP_DIR} + + rm -rf ${TMP_DIR} + + echo + echo "Seite befindet sich nun auf:" + echo "${URL}" + echo +done |