Deploying documentation¶
The PTB uses ref:sphinx to build and validate the contents
of your project’s documentation. PTB expects the project’s documentation in directory doc,
primarily as rst files. The doc/conf.py acts as the configuration file for building the
documentation.
GitHub workflow checks.yml also runs the checks for the documentation.
This enables updating and fixing the documentation together with other changes in the same pull request.
The final building & serving of the documentation happens in GitHub workflow gh-pages.yml.
| Nox session | CI Usage | Action | 
|---|---|---|
| 
 | 
 | Builds the documentation | 
| 
 | No | Removes the documentation build folder | 
| 
 | 
 | Builds the multiversion documentation | 
| 
 | No | Opens the built documentation | 
| 
 | 
 | Checks if all links in the documentation are accessible | 
| 
 | No | Lists all links in the documentation | 
Configuration¶
doc/conf.py¶
The PTB’s cookiecutter project template already provides a file doc/conf.py with
default content. If your project needs adjustment, please refer to:
- specifically to the Linkcheck Builder for - links:checkand- links:list.
gh-pages.yml¶
GitHub workflow gh-pages.yml uses actions upload-pages-artifact and deploy-pages.
In order to properly deploy your generated documentation, you will need to manually
reconfigure the GitHub Pages settings for the repo:
- Go to the affected repo’s GitHub page 
- Select ‘Settings’ 
- Scroll down & select ‘Pages’ 
- Within the ‘Build and deployment’ section, change ‘Source’ to ‘GitHub Actions’. 
You also need to configure settings for the github-pages environment:
- Go to the affected repo’s GitHub page 
- Select ‘Settings’ 
- Scroll down & select ‘Environment’ 
- Click on ‘github-pages’ 
- In the ‘Deployment branches and tags’, click ‘Add deployment branch or tag rule’ 
- 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)