-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·38 lines (31 loc) · 964 Bytes
/
Copy pathdeploy.sh
File metadata and controls
executable file
·38 lines (31 loc) · 964 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
HOST="root@webserver.skelpo.net"
REMOTE="/var/www/hone.codes"
ROOT_FILES=(index.html style.css og-image.png screenshot.png)
LANGS=(de ja zh-Hans es fr pt ko it tr th id vi)
# Regenerate og-image.png from svg if svg is newer
if [ og-image.svg -nt og-image.png ]; then
echo "og-image.svg has changed, regenerating og-image.png..."
rsvg-convert -w 1200 -h 630 og-image.svg -o og-image.png
fi
# Verify root files exist
for f in "${ROOT_FILES[@]}"; do
if [ ! -f "$f" ]; then
echo "error: $f not found" >&2
exit 1
fi
done
echo "Deploying to $HOST:$REMOTE ..."
# Deploy root files
scp "${ROOT_FILES[@]}" "$HOST:$REMOTE/"
# Deploy locale directories
for lang in "${LANGS[@]}"; do
if [ ! -f "$lang/index.html" ]; then
echo "error: $lang/index.html not found" >&2
exit 1
fi
ssh "$HOST" "mkdir -p $REMOTE/$lang"
scp "$lang/index.html" "$HOST:$REMOTE/$lang/"
done
echo "Done → https://hone.codes"