aboutsummaryrefslogtreecommitdiffstats
path: root/hooks/post-receive
blob: d4920101a9455181df36e8b723bc28a3ee3de306 (plain) (blame)
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
#!/bin/sh
set -e
WORK=/home/git/build/ccc
COFFEE=/var/www/coffee.gumx.cc
DEMO=/var/www/demo.gumx.cc

# ── coffee.gumx.cc (personal log: DATA_URL=data.json, with footer) ──────────
mkdir -p "$COFFEE/styles" "$COFFEE/fonts"
cp "$WORK/ccc.html"          "$COFFEE/index.html"
cp "$WORK/favicon.svg"       "$COFFEE/favicon.svg"
cp "$WORK/styles/main.css"   "$COFFEE/styles/main.css"
cp "$WORK/styles/ccc.css"    "$COFFEE/styles/ccc.css"
rsync -rlptD "$WORK/fonts/"  "$COFFEE/fonts/" 2>/dev/null || true

# ── demo.gumx.cc/ccc (public demo: local mode, no footer) ───────────────────
mkdir -p "$DEMO/ccc" "$DEMO/styles" "$DEMO/fonts"
python3 - "$WORK/ccc.html" "$DEMO/ccc/index.html" <<'EOF'
import sys, re
src, dst = sys.argv[1], sys.argv[2]
html = open(src).read()
html = html.replace('DATA_URL: "data.json"', 'DATA_URL: ""')
html = re.sub(r'\n  <footer>.*?</footer>', '', html, flags=re.DOTALL)
open(dst, 'w').write(html)
EOF
cp "$WORK/favicon.svg"       "$DEMO/favicon.svg"
cp "$WORK/styles/main.css"   "$DEMO/styles/main.css"
cp "$WORK/styles/ccc.css"    "$DEMO/styles/ccc.css"
rsync -rlptD "$WORK/fonts/"  "$DEMO/fonts/" 2>/dev/null || true

echo "ccc deployed to coffee.gumx.cc and demo.gumx.cc/ccc"