blob: a564c7942281263dcbb734c9a2b67027ab9dd4cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
|