This is a simple project with a working pipeline for building and distributing sphinx documentation through GitHub Pages — mostly because I can't find an immediate use for this, and will 100% have forgotten how to do it by the time I do.
The workflow has the following steps:
- A push to the main branch (containing markdown source) triggers a sphinx HTML build.
- The HTML build is dropped to the gh-pages branch.
- The website, hosted by Pages, gets updated according to the new HTML content in gh-pages
The two main steps to set this up were:
- Set up ammaraskar's sphinx-action GitHub action in a yml file in .github/workflows. For a full example, see sphinx-action-test.
- On the Settings/Pages tab, set GitHub Pages to follow the gh-pages branch.
It's also possible to set up a custom domain for the website; I haven't got round to implementing this successfully (encountered issues with HTTPS validation), but it should involve creating A, AAAA and ALIAS records through the domain provider, as well as tinkering with the GitHub action to ensure a CNAME file containing the domain gets placed in the gh-pages branch.