-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild-site.sh
More file actions
executable file
·69 lines (58 loc) · 2.45 KB
/
build-site.sh
File metadata and controls
executable file
·69 lines (58 loc) · 2.45 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
#!/bin/bash
# Build Jekyll site from website/ subdir to avoid config loading issues
# Usage: ./build-site.sh [--dev|--serve]
# --dev|--serve: Run in development mode with jekyll serve for local testing (watches files, serves on http://localhost:4000)
set -e # Exit on error
# Parse arguments
MODE="build"
while [[ $# -gt 0 ]]; do
case $1 in
--dev|--serve)
MODE="serve"
shift
;;
*)
echo "Unknown option $1"
echo "Usage: ./build-site.sh [--dev|--serve]"
exit 1
;;
esac
done
if [ "$MODE" = "serve" ]; then
echo "Starting Jekyll development server..."
else
echo "Building Jekyll site..."
fi
cd website/ || { echo "Failed to cd to website/"; exit 1; }
# Copy root docs/ into website/docs/ for Jekyll processing (Markdown to HTML conversion)
echo "Copying root docs/ to website/docs/..."
rm -rf docs/ # Clean previous copy
mkdir -p docs/
cp -r ../docs/* docs/ 2>/dev/null || echo "No docs/ to copy or copy failed (non-fatal for initial setup)"
# Copy root LICENSE and CONTRIBUTING.md for site links (static and rendered)
echo "Copying root LICENSE and CONTRIBUTING.md..."
cp ../LICENSE ./ 2>/dev/null || echo "LICENSE copy failed (non-fatal)"
cp ../CONTRIBUTING.md ./ 2>/dev/null || echo "CONTRIBUTING.md copy failed (non-fatal)"
ls -la LICENSE CONTRIBUTING.md || echo "Copied files verification failed"
if [ "$MODE" = "serve" ]; then
# Serve with watch mode for development (no clean, incremental builds)
# Note: For live reload of docs/, manually re-run or use a watcher; copy happens on each start
bundle exec jekyll serve --source . --verbose
else
# Clean previous builds
rm -rf ../_site/ ../.jekyll-cache/
# Re-copy docs/ after clean for fresh build
rm -rf docs/
mkdir -p docs/
cp -r ../docs/* docs/ 2>/dev/null || echo "No docs/ to copy or copy failed (non-fatal)"
# Re-copy root LICENSE and CONTRIBUTING.md after clean
cp ../LICENSE ./ 2>/dev/null || echo "LICENSE copy failed (non-fatal)"
cp ../CONTRIBUTING.md ./ 2>/dev/null || echo "CONTRIBUTING.md copy failed (non-fatal)"
cp ../get-zk0bot.sh ./ 2>/dev/null || echo "get-zk0bot.sh copy failed (non-fatal)"
ls -la LICENSE CONTRIBUTING.md get-zk0bot.sh || echo "Copied files verification failed"
# Build with explicit source/destination
bundle exec jekyll build --source . --destination ../_site --verbose
cd .. || true
echo "Jekyll build complete. Generated files in _site/ with URLs using https://zk0.bot"
echo "Verify: cat _site/sitemap.xml"
fi