Skip to content

Commit 319b35f

Browse files
authored
fix: update ci to use latest docs preprocessing (#3067)
1 parent e5a9976 commit 319b35f

2 files changed

Lines changed: 22 additions & 25 deletions

File tree

.github/workflows/docs.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ jobs:
2121
- name: Generate CLI docs
2222
run: go run ./tools/gendocs/main.go -o docs/cli.md
2323

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

2928
- name: Deploy
3029
run: |
3130
pip install mkdocs-material
32-
mkdocs gh-deploy --force
31+
mkdocs gh-deploy -f "${{ steps.stage.outputs.config }}" --force

mise.toml

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -678,15 +678,11 @@ run = "rm -f integration-tests/.bin/cog pkg/wheels/cog-*.whl pkg/wheels/coglet-*
678678
# Docs tasks
679679
# =============================================================================
680680

681-
[tasks.docs]
682-
description = "Build documentation"
683-
sources = ["docs/**/*.md", "README.md", "CONTRIBUTING.md", "mkdocs.yml"]
684-
outputs = ["site/**"]
681+
[tasks."docs:stage"]
682+
description = "Stage documentation for building (preprocess links, prepare .docs-build)"
685683
run = """
686684
#!/usr/bin/env bash
687685
set -e
688-
uv pip install mkdocs-material
689-
690686
rm -rf .docs-build
691687
cp -r docs .docs-build
692688
@@ -700,28 +696,30 @@ cp CONTRIBUTING.md .docs-build/CONTRIBUTING.md
700696
701697
# Point mkdocs at the staged docs directory.
702698
sed 's|^docs_dir: docs/|docs_dir: .docs-build/|' mkdocs.yml > .docs-build-mkdocs.yml
703-
mkdocs build -f .docs-build-mkdocs.yml
699+
700+
echo .docs-build-mkdocs.yml
701+
"""
702+
703+
[tasks.docs]
704+
description = "Build documentation"
705+
sources = ["docs/**/*.md", "README.md", "CONTRIBUTING.md", "mkdocs.yml"]
706+
outputs = ["site/**"]
707+
run = """
708+
#!/usr/bin/env bash
709+
set -e
710+
config="$(mise run --quiet docs:stage)"
711+
uv pip install mkdocs-material
712+
mkdocs build -f "$config"
704713
"""
705714

706715
[tasks."docs:serve"]
707716
description = "Serve documentation locally"
708717
run = """
709718
#!/usr/bin/env bash
710719
set -e
720+
config="$(mise run --quiet docs:stage)"
711721
uv pip install mkdocs-material
712-
713-
rm -rf .docs-build
714-
cp -r docs .docs-build
715-
716-
# This strips exactly one "../" from any relative path to README.md, handling pages at any nesting depth.
717-
find .docs-build -name '*.md' -type f -exec sed -i.bak 's|\\.\\./\\(\\.\\./\\)*README\\.md|\\1README.md|g' {} +
718-
find .docs-build -name '*.md.bak' -type f -delete
719-
720-
sed 's/docs\\///g' README.md > .docs-build/README.md
721-
cp CONTRIBUTING.md .docs-build/CONTRIBUTING.md
722-
723-
sed 's|^docs_dir: docs/|docs_dir: .docs-build/|' mkdocs.yml > .docs-build-mkdocs.yml
724-
mkdocs serve -f .docs-build-mkdocs.yml
722+
mkdocs serve -f "$config"
725723
"""
726724

727725
[tasks."docs:llm"]

0 commit comments

Comments
 (0)