Build and deploy documentation for Pyscaffold-based projects on GitHub Pages.
GitHub Action to automatically build the documentation of a Python project based on Pyscaffold and publish it on GitHub Pages.
See Repository pyscaffold-gh-pages-deploy-test for a demo project generating documentation on Github Pages.
Individual steps used by this GitHub Action:
- Install dependencies (tox)
- Configure git
- Create branch gh-pages in the repository if it doesn't exist. Warning: if the branch exists already, it will be overwritten
- Checkout the main branch
- Build documentation using
tox -e docs
- Push the documentation to the gh-pages branch
You can add this action to your GitHub Workflow by adding a YAML file with the name gh-pages-deploy.yml
in the folder .github/workflows
of your repo with following content:
name: gh-pages-deploy
on:
push:
branches:
- main
jobs:
gh-pages-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Deploy docs to GitHub Pages
uses: Kopfstein/pyscaffold-gh-pages-deploy@latest
This project was developed using information and/or code snippets from following projects. Thanks to the authors of these projects for creating open source software!