-
-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathbuild_docs.sh
More file actions
executable file
·92 lines (82 loc) · 2.85 KB
/
Copy pathbuild_docs.sh
File metadata and controls
executable file
·92 lines (82 loc) · 2.85 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env bash
# Build documentation locally with changelog generation
# This mirrors the GitHub Actions workflow for local testing
#
# Usage:
# ./build_docs.sh # Generate changelog and build docs
# ./build_docs.sh serve # Generate changelog and serve docs with live reload
# ./build_docs.sh --bump # Build with auto-bumped version number
# ./build_docs.sh --help # Show help
set -e # Exit on error
# Parse arguments
SERVE=false
if [[ "$1" == "serve" ]]; then
SERVE=true
elif [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]]; then
echo "Usage: $0 [serve] [--bump]"
echo ""
echo "Build documentation locally with changelog generation."
echo ""
echo "Options:"
echo " (none) Generate changelog for unreleased changes and build static docs"
echo " serve Generate changelog and serve docs with live reload"
echo " --bump Auto-calculate next version and preview release changelog"
echo " --help Show this help message"
echo ""
echo "Examples:"
echo " $0 # Build with [Unreleased] section"
echo " $0 --bump # Build with auto-bumped version (e.g., v1.2.5)"
echo " $0 serve --bump # Serve with bumped version preview"
exit 0
fi
echo "🔨 Building Fit File Faker documentation..."
echo ""
# Check if git-cliff is installed
if ! command -v git &> /dev/null; then
echo "❌ Error: git-cliff is not installed"
echo "Install it with: brew install git-cliff (macOS)"
echo " or: cargo install git-cliff (Rust)"
exit 1
fi
# Generate changelog with git-cliff
echo "📝 Generating changelog with git-cliff..."
# Check if --bump flag was passed
if [[ "$*" =~ --bump ]]; then
NEXT_VERSION=$(git cliff --bumped-version --unreleased)
echo "🔢 Auto-bumped version: $NEXT_VERSION (preview)"
git cliff --verbose --output docs/changelog.md --tag "$NEXT_VERSION" --unreleased
else
git cliff --verbose --output docs/changelog.md --unreleased
fi
# Append historical changelog
echo "📜 Appending historical changelog..."
{
echo ""
echo "---"
echo ""
cat docs/.changelog_pre_1.3.0.md
} >> docs/changelog.md
echo "✅ Changelog generated: docs/changelog.md"
echo ""
# Check if mkdocs is installed
if ! command -v uv run mkdocs &> /dev/null; then
echo "❌ Error: mkdocs not found"
echo "Install with: uv sync --group docs"
exit 1
fi
# Build or serve based on option
if [ "$SERVE" = true ]; then
echo "🌐 Starting mkdocs development server..."
echo "📍 Documentation will be available at: http://127.0.0.1:8000"
echo ""
echo "Press Ctrl+C to stop the server"
echo ""
uv run mkdocs serve
else
echo "📚 Building documentation with mkdocs..."
uv run mkdocs build
echo ""
echo "✅ Documentation built to: site/"
echo ""
echo "💡 To serve locally with live reload, run: $0 serve"
fi