In order to update the Read The Docs (RTD) project, there are a series of steps that must be performed to ensure the changes are present and consistent between the hosted and local builds of the project.
The local build process should be triggered using make run in the docs
project directory. The Makefile orchestrates the build process, serves the
webpage, and provides checks for many different compliance metrics. To view a
list of supported compliance checks run make without arguments.
conf.py- Used by the Sphinx document generator to configure the build process. Configures the context for the HTML page. The metadata for this project has not been configured yet.pre-build-job.sh- Used with Sphinx to create a standard set of actions that are run before every build. For the Snap project, this script gets the latest build artifact from snapd-rest-openapi and places them in a directory that Sphinx has been configured to include in the build process.
Since the RTD build process uses a hosted environment, configuration is done via files located in the GitHub repository. The following file is used for exclusive modifications to the RTD build process:
.readthedocs.yaml- Used by RTD to control the build process. This file contains information necessary for environment setup, and allows for configuring the build jobs that sphinx uses.
For the Snap documentation use case, we are interacting with actions in other
GitHub repositories, requiring the use of the gh command line tool. To prevent
any issues with rate limiting on the RTD build servers, a token is configured in
the RTD project settings, which is only accessible by organization admins. The
token is assigned to an environment variable prior to launching the
pre-build-job, and upon running gh will read this token and use it to
authenticate with GitHub.
The hosted build process is handled remotely by RTD, with little intervention allowed outside the GitHub repository, according to the following workflow:
- Upon a pull request being merged to the main repo, RTD detects changes have been made and checks out the latest commit.
- The build process begins and a console output is available via the RTD Webpage. The build takes approximately 20 minutes.
- If the build process is successful, the generated documentation will be hosted here.