From 0fd1a0306cd025fc16785dad8f2e208b9d60cb29 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Thu, 26 Jul 2012 16:02:19 +0200 Subject: initial commit --- post-receive.cyrax-build | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 post-receive.cyrax-build 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 -- cgit v1.2.3-1-g7c22