|
1 | 1 | Documentation (GitHub Actions) |
2 | 2 | ============================== |
3 | 3 |
|
4 | | -This page explains how the repository builds the Sphinx documentation and publishes |
5 | | -the generated HTML to GitHub Pages using GitHub Actions. |
| 4 | +This page explains how the repository builds the Sphinx documentation and publishes the generated HTML to GitHub Pages using GitHub Actions. |
6 | 5 |
|
7 | 6 | The workflow does the following: |
8 | 7 |
|
9 | | -- Whenever a commit is pushed to `main`, the workflow checks out the repository (manual dispatch is also supported). |
10 | | -- Sets up Python and installs the ``docs`` dependencies from :file:`pyproject.toml`. |
11 | | -- Builds HTML with ``sphinx-build`` into ``docs/_build/html``. |
12 | | -- Uploads the built HTML as a Pages artifact and deploys it to GitHub Pages. |
| 8 | +1. Whenever a commit is pushed to `main`, the workflow checks out the repository (manual dispatch is also supported). |
| 9 | +2. Sets up Python and installs the ``docs`` dependencies from :file:`pyproject.toml`. |
| 10 | +3. Builds HTML with ``sphinx-build`` into ``docs/_build/html``. |
| 11 | +4. Uploads the built HTML as a Pages artifact and deploys it to GitHub Pages. |
| 12 | + |
| 13 | +.. note:: |
| 14 | + |
| 15 | + First ensure the documentation is built correctly locally. See the previous page :doc:`Documentation (local) <docs_local>`. |
| 16 | + |
| 17 | + |
| 18 | +.. note:: |
| 19 | + Best practice: do NOT commit generated files (``docs/_build``, ``docs/_autosummary``) to the repository. |
| 20 | + Keep them in ``.gitignore`` and let CI produce the HTML. |
| 21 | + If you plan to serve source HTML directly from the ``docs/`` folder (without a build step), then you'd need to commit generated files — but the current workflow builds on CI and deploys the result, so committing generated files is unnecessary. |
13 | 22 |
|
14 | 23 | Repository setup (one-time) |
15 | 24 | --------------------------- |
16 | 25 | 1. Ensure the repository has GitHub Pages enabled for the ``gh-pages`` site (no manual branch required when using the Pages actions). In repository Settings → Pages you should see the site status after the first successful run. |
17 | 26 | 2. No secret is required. The workflow uses the repository's built-in ``GITHUB_TOKEN`` permissions to publish pages. |
18 | 27 |
|
19 | | -Local testing |
20 | | -------------- |
21 | | -See the previous page :doc:`Local documentation <docs_local>` for additional local setup and testing instructions. |
22 | | - |
23 | | -Autosummary and generated files |
24 | | -------------------------------- |
25 | | -- ``autosummary_generate = True`` is enabled in ``docs/conf.py``, so Sphinx will generate the ``_autosummary`` pages during the build. |
26 | | -- Best practice: do NOT commit generated files (``docs/_build``, ``docs/_autosummary``) to the repository. Keep them in ``.gitignore`` and let CI produce the HTML. If you plan to serve source HTML directly from the ``docs/`` folder (without a build step), then you'd need to commit generated files — but the current workflow builds on CI and deploys the result, so committing generated files is unnecessary. |
27 | | - |
28 | 28 | Troubleshooting |
29 | 29 | --------------- |
30 | 30 | - If builds fail due to missing packages, ensure :file:`pyproject.toml` contains the correct ``docs`` extras and that ``pip install -e ".[docs]"`` succeeds. |
31 | 31 | - If the site does not appear after the workflow succeeds, check Settings → Pages to ensure the site is not blocked by organization policy. |
32 | | - |
33 | | -The workflow will attempt to publish your Sphinx docs automatically when you push to ``main``. |
0 commit comments