#/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