Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ jobs:
- name: Generate CLI docs
run: go run ./tools/gendocs/main.go -o docs/cli.md

- name: Copy top-level docs like README and CONTRIBUTING
run: |
sed 's/docs\///g' README.md > ./docs/README.md
cp CONTRIBUTING.md ./docs/
- name: Prepare docs
id: stage
run: echo "config=$(mise run --quiet docs:stage)" >> "$GITHUB_OUTPUT"

- name: Deploy
run: |
pip install mkdocs-material
mkdocs gh-deploy --force
mkdocs gh-deploy -f "${{ steps.stage.outputs.config }}" --force
38 changes: 18 additions & 20 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -678,15 +678,11 @@ run = "rm -f integration-tests/.bin/cog pkg/wheels/cog-*.whl pkg/wheels/coglet-*
# Docs tasks
# =============================================================================

[tasks.docs]
description = "Build documentation"
sources = ["docs/**/*.md", "README.md", "CONTRIBUTING.md", "mkdocs.yml"]
outputs = ["site/**"]
[tasks."docs:stage"]
description = "Stage documentation for building (preprocess links, prepare .docs-build)"
run = """
#!/usr/bin/env bash
set -e
uv pip install mkdocs-material

rm -rf .docs-build
cp -r docs .docs-build

Expand All @@ -700,28 +696,30 @@ cp CONTRIBUTING.md .docs-build/CONTRIBUTING.md

# Point mkdocs at the staged docs directory.
sed 's|^docs_dir: docs/|docs_dir: .docs-build/|' mkdocs.yml > .docs-build-mkdocs.yml
mkdocs build -f .docs-build-mkdocs.yml

echo .docs-build-mkdocs.yml
"""

[tasks.docs]
description = "Build documentation"
sources = ["docs/**/*.md", "README.md", "CONTRIBUTING.md", "mkdocs.yml"]
outputs = ["site/**"]
run = """
#!/usr/bin/env bash
set -e
config="$(mise run --quiet docs:stage)"
uv pip install mkdocs-material
mkdocs build -f "$config"
"""

[tasks."docs:serve"]
description = "Serve documentation locally"
run = """
#!/usr/bin/env bash
set -e
config="$(mise run --quiet docs:stage)"
uv pip install mkdocs-material

rm -rf .docs-build
cp -r docs .docs-build

# This strips exactly one "../" from any relative path to README.md, handling pages at any nesting depth.
find .docs-build -name '*.md' -type f -exec sed -i.bak 's|\\.\\./\\(\\.\\./\\)*README\\.md|\\1README.md|g' {} +
find .docs-build -name '*.md.bak' -type f -delete

sed 's/docs\\///g' README.md > .docs-build/README.md
cp CONTRIBUTING.md .docs-build/CONTRIBUTING.md

sed 's|^docs_dir: docs/|docs_dir: .docs-build/|' mkdocs.yml > .docs-build-mkdocs.yml
mkdocs serve -f .docs-build-mkdocs.yml
mkdocs serve -f "$config"
"""

[tasks."docs:llm"]
Expand Down