-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocsrc_build.sh
More file actions
executable file
·57 lines (48 loc) · 1.32 KB
/
Copy pathdocsrc_build.sh
File metadata and controls
executable file
·57 lines (48 loc) · 1.32 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
#!/usr/bin/env bash
# Build and prepare CRO docs for local or GitHub Pages
# Usage: ./docsrc_build.sh [local|publish]
set -e
MODE=${1:-local} # default to local if not specified
echo "🚀 Building CRO docs in mode: $MODE"
# Clean
make clean
# Build both projects
make docs
# Prepare switcher.json
SWITCHER_FILE=docs/switcher.json
if [ "$MODE" = "local" ]; then
cat > "$SWITCHER_FILE" <<EOF
[
{"version": "Python", "url": "/python/"},
{"version": "Matlab", "url": "/matlab/"}
]
EOF
echo "🔹 Local switcher.json created (localhost paths)"
else
cat > "$SWITCHER_FILE" <<EOF
[
{"version": "Python", "url": "https://senclimate.github.io/CRO/python/"},
{"version": "Matlab", "url": "https://senclimate.github.io/CRO/matlab/"}
]
EOF
echo "🔹 Production switcher.json created (GitHub Pages paths)"
fi
# Create root landing page (redirect to Python docs by default)
cat > docs/index.html <<EOF
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CRO Documentation</title>
<meta http-equiv="refresh" content="0; url=python/">
</head>
<body>
<p>Redirecting to <a href="python/">Python Documentation</a>...</p>
</body>
</html>
EOF
echo "🔹 Root index.html created (Python docs default)"
# GitHub Pages preparation
touch docs/.nojekyll
git add docs
echo "✅ Docs built and ready at docs/ (mode=$MODE)"