|
| 1 | +.. _deploying_documentation: |
| 2 | + |
| 3 | +Deploying documentation |
| 4 | +======================= |
| 5 | + |
| 6 | +.. toctree:: |
| 7 | + :maxdepth: 2 |
| 8 | + |
| 9 | + multiversion |
| 10 | + troubleshooting |
| 11 | + |
| 12 | +The PTB uses ref:`sphinx <https://www.sphinx-doc.org/>`__ to build and validate the contents |
| 13 | +of your project's documentation. PTB expects the project's documentation in directory ``doc``, |
| 14 | +primarily as ``rst`` files. The ``doc/conf.py`` acts as the configuration file for building the |
| 15 | +documentation. |
| 16 | + |
| 17 | +GitHub workflow ``checks.yml`` also runs the checks for the documention. |
| 18 | +This enables updating and fixing the documentation together with other changes in the same pull request. |
| 19 | +The final building & serving of the documentation happens in GitHub workflow ``gh-pages.yml``. |
| 20 | + |
| 21 | ++--------------------------+------------------+----------------------------------------+ |
| 22 | +| Nox session | CI Usage | Action | |
| 23 | ++==========================+==================+========================================+ |
| 24 | +| ``docs:build`` | ``checks.yml`` | Builds the documentation | |
| 25 | ++--------------------------+------------------+----------------------------------------+ |
| 26 | +| ``docs:clean`` | No | Removes the documentation build folder | |
| 27 | ++--------------------------+------------------+----------------------------------------+ |
| 28 | +| ``docs:multiversion`` | ``gh-pages.yml`` | Builds the multiversion documentation | |
| 29 | ++--------------------------+------------------+----------------------------------------+ |
| 30 | +| ``docs:open`` | No | Opens the built documentation | |
| 31 | ++--------------------------+------------------+----------------------------------------+ |
| 32 | +| ``links:check`` | ``checks.yml`` | Checks if all links in the | |
| 33 | +| | | documentation are accessible | |
| 34 | ++--------------------------+------------------+----------------------------------------+ |
| 35 | +| ``links:list`` | No | Lists all links in the documentation | |
| 36 | ++--------------------------+------------------+----------------------------------------+ |
| 37 | + |
| 38 | +.. _documentation_configuration: |
| 39 | + |
| 40 | +Configuration |
| 41 | ++++++++++++++ |
| 42 | + |
| 43 | +``doc/conf.py`` |
| 44 | +^^^^^^^^^^^^^^^ |
| 45 | +The PTB's cookiecutter project template already provides a file ``doc/conf.py`` with |
| 46 | +default content. If your project needs adjustment, please refer to: |
| 47 | + |
| 48 | +* the `general sphinx documentation <https://www.sphinx-doc.org/en/master/>`__. |
| 49 | +* specifically to the `Linkcheck Builder <https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-the-linkcheck-builder>`__ |
| 50 | + for ``links:check`` and ``links:list``. |
| 51 | + |
| 52 | +``gh-pages.yml`` |
| 53 | +^^^^^^^^^^^^^^^^ |
| 54 | +GitHub workflow ``gh-pages.yml`` uses actions ``upload-pages-artifact`` and ``deploy-pages``. |
| 55 | +In order to properly deploy your generated documentation, you will need to manually |
| 56 | +reconfigure the GitHub Pages settings for the repo: |
| 57 | + |
| 58 | +#. Go to the affected repo's GitHub page |
| 59 | +#. Select 'Settings' |
| 60 | +#. Scroll down & select 'Pages' |
| 61 | +#. Within the 'Build and deployment' section, change 'Source' to 'GitHub Actions'. |
| 62 | + |
| 63 | +You also need to configure settings for the `github-pages` environment: |
| 64 | + |
| 65 | +#. Go to the affected repo's GitHub page |
| 66 | +#. Select 'Settings' |
| 67 | +#. Scroll down & select 'Environment' |
| 68 | +#. Click on 'github-pages' |
| 69 | +#. In the 'Deployment branches and tags', click 'Add deployment branch or tag rule' |
| 70 | +#. Select 'Ref type' to be 'Tag' and set the 'Name pattern' to `[0-9]*.[0-9]*.[0-9]*` (or whatever matches that repo's tags) |
0 commit comments