Skip to content

Commit cb2a9b4

Browse files
angptclaude
andauthored
Migrate docs from MkDocs/GitHub Pages to GitBook (#946)
- Remove mkdocs.yml and the MkDocs GitHub Actions workflow - Add .gitbook.yaml, docs/SUMMARY.md, and .gitbook-branch-readme.md - Add scripts/publish_docs.py: copies public docs/ into site/, excluding internal dirs (AGENTS.md, commands/, skills/) - Add scripts/validate_docs.py: checks SUMMARY links and relative .md links resolve before deployment; runs on every PR - Add CI workflow that builds, validates, and pushes site/ to an orphan gitbook-docs branch on push to main - Replace 15 hardcoded mozilla-ai.github.io URLs with relative links - Fix /tests/integration/README.md root-absolute path in source_installation.md to a full GitHub URL Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ea67fea commit cb2a9b4

13 files changed

Lines changed: 299 additions & 105 deletions

.gitbook-branch-readme.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# GitBook Documentation Branch
2+
3+
The `gitbook-docs` branch contains **published** GitBook-compatible documentation,
4+
automatically updated by GitHub Actions on every push to `main`.
5+
6+
**Do not edit this branch manually** — all changes will be overwritten.
7+
8+
## How it works
9+
10+
1. `scripts/publish_docs.py` copies public docs from `docs/` into `site/`, excluding
11+
internal developer docs (`AGENTS.md`, `commands/`, `skills/`)
12+
2. The contents of `site/` are pushed to this branch
13+
3. GitBook syncs from this branch
14+
15+
## Editing docs
16+
17+
Edit markdown files in [`docs/`](https://github.com/mozilla-ai/llamafile/tree/main/docs)
18+
on the `main` branch. The `gitbook-docs` branch will update automatically on the next
19+
push to `main` that touches `docs/`.

.gitbook.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
root: ./docs
2+
3+
structure:
4+
readme: index.md
5+
summary: SUMMARY.md

.github/workflows/docs.yml

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ on:
44
push:
55
branches: [main]
66
paths:
7-
- mkdocs.yml
87
- 'docs/**'
8+
- 'scripts/publish_docs.py'
9+
- 'scripts/validate_docs.py'
10+
- '.gitbook.yaml'
911
- '.github/workflows/docs.yml'
1012
pull_request:
1113
paths:
12-
- mkdocs.yml
1314
- 'docs/**'
15+
- 'scripts/publish_docs.py'
16+
- 'scripts/validate_docs.py'
17+
- '.gitbook.yaml'
1418
- '.github/workflows/docs.yml'
1519
workflow_dispatch:
1620

@@ -21,28 +25,37 @@ jobs:
2125
runs-on: ubuntu-latest
2226
steps:
2327
- name: Check out the repository
24-
uses: actions/checkout@v5
28+
uses: actions/checkout@v4
2529
with:
2630
fetch-depth: 0
2731

28-
- name: Set up Python
29-
uses: actions/setup-python@v5
30-
with:
31-
python-version: '3.x'
32+
- name: Build GitBook site
33+
run: python scripts/publish_docs.py
34+
35+
- name: Validate site output
36+
run: python scripts/validate_docs.py
3237

33-
- name: Configure git
38+
- name: Deploy to gitbook-docs branch
39+
if: "${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}"
3440
run: |
3541
git config user.name 'github-actions[bot]'
3642
git config user.email 'github-actions[bot]@users.noreply.github.com'
43+
cp .gitbook-branch-readme.md site/README-BRANCH.md
3744
38-
- name: Install dependencies
39-
run: |
40-
pip install mkdocs-material
45+
# Move site/ outside the repo before switching branches
46+
mv site/ /tmp/gitbook-site/
4147
42-
- name: Build docs
43-
if: github.event_name == 'pull_request'
44-
run: mkdocs build -s
48+
git fetch origin gitbook-docs || true
49+
if git rev-parse --verify origin/gitbook-docs >/dev/null 2>&1; then
50+
git checkout gitbook-docs
51+
else
52+
git checkout --orphan gitbook-docs
53+
git rm -rf .
54+
fi
4555
46-
- name: Publish docs
47-
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
48-
run: mkdocs gh-deploy --force
56+
rsync -a --delete --exclude='.git' /tmp/gitbook-site/ .
57+
git add -A
58+
if ! git diff --cached --quiet; then
59+
git commit -m "docs: update GitBook documentation from ${{ github.sha }}"
60+
git push origin gitbook-docs
61+
fi

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ CLAUDE.md
2020
*.pyc
2121
__init__.py
2222
uv.lock
23+
24+
# docs build output (pushed to gitbook-docs branch by CI)
25+
/site

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,25 @@ chmod +x Qwen3.5-0.8B-Q8_0.llamafile
5858

5959
We chose this model because that's the smallest one we have
6060
built a llamafile for, so most likely to work out-of-the-box for you.
61-
If you have powerful hardware and/or GPUs, [feel free to choose](https://mozilla-ai.github.io/llamafile/example_llamafiles/)
61+
If you have powerful hardware and/or GPUs, [feel free to choose](docs/example_llamafiles.md)
6262
larger and more expressive models which should provide more accurate
6363
responses.
6464

6565
**Windows users:** Rename the file to add `.exe` extension before running.
6666

6767
## Documentation
6868

69-
Check the full documentation in the [docs/](docs/) folder or online at [mozilla-ai.github.io/llamafile](https://mozilla-ai.github.io/llamafile/), or directly jump into one of the following subsections:
70-
71-
- [Quickstart](https://mozilla-ai.github.io/llamafile/quickstart/)
72-
- [Example llamafiles](https://mozilla-ai.github.io/llamafile/example_llamafiles/)
73-
- [Running a llamafile](https://mozilla-ai.github.io/llamafile/running_llamafile/)
74-
- [Creating llamafiles](https://mozilla-ai.github.io/llamafile/creating_llamafiles/)
75-
- [Source installation](https://mozilla-ai.github.io/llamafile/source_installation/)
76-
- [Technical details](https://mozilla-ai.github.io/llamafile/technical_details/)
77-
- [Supported Systems](https://mozilla-ai.github.io/llamafile/support/)
78-
- [Troubleshooting](https://mozilla-ai.github.io/llamafile/troubleshooting/)
79-
- [Whisperfile](https://mozilla-ai.github.io/llamafile/whisperfile/)
69+
Check the full documentation in the [docs/](docs/) folder, or directly jump into one of the following subsections:
70+
71+
- [Quickstart](docs/quickstart.md)
72+
- [Example llamafiles](docs/example_llamafiles.md)
73+
- [Running a llamafile](docs/running_llamafile.md)
74+
- [Creating llamafiles](docs/creating_llamafiles.md)
75+
- [Source installation](docs/source_installation.md)
76+
- [Technical details](docs/technical_details.md)
77+
- [Supported Systems](docs/support.md)
78+
- [Troubleshooting](docs/troubleshooting.md)
79+
- [Whisperfile](docs/whisperfile/index.md)
8080

8181

8282
## Licensing

README_0.10.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ mode) are new.
5353
[20251218](https://github.com/mozilla-ai/llamafile/discussions/845)
5454
- added Metal support: GPU on MacOS ARM64 is supported by compiling a small module
5555
using the Xcode Command Line Tools, which need to be installed. Check our docs at
56-
https://mozilla-ai.github.io/llamafile/support/#gpu-support for more info.
56+
[docs/support.md#gpu-support](docs/support.md#gpu-support) for more info.
5757
- Metal works both in llamafile (called either as TUI or with the --server flag)
5858
and in llama-server.
5959

docs/SUMMARY.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Table of contents
2+
3+
* [Home](index.md)
4+
5+
## Getting Started
6+
7+
* [Quickstart](quickstart.md)
8+
* [Example llamafiles](example_llamafiles.md)
9+
10+
## Using llamafile
11+
12+
* [Running a llamafile](running_llamafile.md)
13+
* [Creating llamafiles](creating_llamafiles.md)
14+
* [Source installation](source_installation.md)
15+
* [Building DLLs](building_dlls.md)
16+
17+
## Reference
18+
19+
* [Technical details](technical_details.md)
20+
* [Supported Systems](support.md)
21+
* [Troubleshooting](troubleshooting.md)
22+
23+
## Whisperfile
24+
25+
* [Overview](whisperfile/index.md)
26+
* [Getting Started](whisperfile/getting-started.md)
27+
* [Packaging](whisperfile/packaging.md)
28+
* [Using GPUs](whisperfile/gpu.md)
29+
* [Translation](whisperfile/translate.md)
30+
* [Server](whisperfile/server.md)

docs/building_dlls.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ At the end of this process, you should have the following libraries available in
6868
03/31/2026 02:46 PM 31,482,880 ggml-vulkan.dll
6969
```
7070

71-
To run llamafile with these libraries, add them in your home directory or bundle them in your llamafile (see [Creating a llamafile](https://mozilla-ai.github.io/llamafile/creating_llamafiles/)).
71+
To run llamafile with these libraries, add them in your home directory or bundle them in your llamafile (see [Creating a llamafile](creating_llamafiles.md)).

docs/creating_llamafiles.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ make o//third_party/zipalign
2929
- **The llamafile executable** — download a prebuilt binary from the
3030
[releases page](https://github.com/mozilla-ai/llamafile/releases), or build
3131
from source following
32-
[these instructions](https://mozilla-ai.github.io/llamafile/source_installation/).
32+
[these instructions](source_installation.md).
3333

3434
- **Model weights in GGUF format** — download from Hugging Face
3535
([search here](https://huggingface.co/models?library=gguf)), or use weights
3636
already on disk from
37-
[another application](https://mozilla-ai.github.io/llamafile/quickstart/#running-llamafile-with-models-downloaded-by-third-party-applications).
37+
[another application](quickstart.md#running-llamafile-with-models-downloaded-by-third-party-applications).
3838

3939
- **A `.args` file** — specifies default arguments (at minimum, the model
4040
path so it loads automatically).

docs/source_installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ make check
4747
This runs our unit tests to ensure everything is built correctly.
4848

4949
Some integration tests in `tests/integration` are available to test llamafile
50-
with real models. Check the [README](/tests/integration/README.md) to learn how to run them.
50+
with real models. Check the [README](https://github.com/mozilla-ai/llamafile/blob/main/tests/integration/README.md) to learn how to run them.
5151

5252
### Running llamafile
5353

0 commit comments

Comments
 (0)