summaryrefslogtreecommitdiffstats
path: root/post-receive.cyrax-build
diff options
context:
space:
mode:
Diffstat (limited to 'post-receive.cyrax-build')
-rwxr-xr-xpost-receive.cyrax-build39
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