-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·76 lines (67 loc) · 2.6 KB
/
Copy pathdeploy.sh
File metadata and controls
executable file
·76 lines (67 loc) · 2.6 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env bash
# Build the DZSL website and publish it to Cloudflare Pages.
#
# ./deploy.sh
#
# First run only: Wrangler will open your browser to log into Cloudflare
# ("Allow"), then ask to create the Pages project named "dayzlinux"
# (choose yes / "Create a new project", production branch: main).
# After that, every run just rebuilds and uploads — no prompts.
set -euo pipefail
cd "$(dirname "$0")"
if [[ ! -d node_modules ]]; then
echo "Installing dependencies..."
npm install
fi
echo "Writing updates feed..."
# Commits whose message starts with [news] appear in the site's ticker.
# git commit -m "[news] Server search and filter launched" -> keyword-tagged
# git commit -m "[news:release] DZSL 0.9.0 RC is out" -> explicit tag wins
python3 - <<'PYEOF'
import subprocess, json, re, sys
CATEGORIES = [
("Release", r"\brelease\b|\brc\b|\bcandidate\b|\bv?\d+\.\d+(\.\d+)?\b"),
("Launcher", r"\blauncher\b|\bdzsl\b|\bworkshop\b|\bmods?\b|\bsteam\b|\bflatpak\b"),
("Gold", r"\bgold\b|\bpromot|\bclaim|\bowner|\bbanner\b"),
("Website", r"\bpage\b|\bsite\b|\bbrowser\b|\bticker\b|\bsearch\b|\bfilter\b|\bnews\b"),
("Fix", r"\bfix|\bbug\b|\bresolved?\b|\bpatch"),
]
def categorize(text, explicit):
if explicit:
return explicit.capitalize()
lower = text.lower()
for label, pattern in CATEGORIES:
if re.search(pattern, lower):
return label
return "Update"
result = subprocess.run(
["git", "log", "main", "--pretty=format:%s", "-n", "50"],
capture_output=True, text=True
)
items = []
for line in result.stdout.splitlines():
m = re.match(r"^\[news(?::([a-zA-Z]+))?\]\s*(.*)", line)
if m:
text = m.group(2).strip()
items.append({"label": categorize(text, m.group(1)), "text": text})
if len(items) >= 5:
break
if not items:
# Keep the existing public/updates.json unchanged
sys.exit(0)
with open("public/updates.json", "w") as f:
json.dump(items, f, indent=2)
print(f" {len(items)} news item(s) written to public/updates.json")
PYEOF
echo "Building site..."
npm run build
echo "Publishing to Cloudflare Pages..."
# Force the production branch so the deploy reaches the live custom domain
# (dayzlinux.com is bound to the Production environment = branch "main").
# Without --branch, Wrangler tags the deploy with the current git branch
# (e.g. claude/work), which only ever produces a preview deployment.
npx wrangler pages deploy ./dist --project-name dayzlinux --branch main
echo
echo "Deployment complete."
echo "Site: https://dayzlinux.com"
echo "Pages: https://dayzlinux.pages.dev"