CI/CD with GitHub Actions¶
This project uses GitHub Actions to automate the deployment of your MkDocs documentation.
Workflow File¶
A workflow file is included at:
.github/workflows/deploy.yml
This file defines a pipeline that:
- Runs on every push to the
main
branch - Installs Python and MkDocs in the GitHub-hosted runner
- Builds the documentation
- Deploys it to the
gh-pages
branch usingmkdocs gh-deploy
Sample Workflow¶
Here's a simplified version of the workflow file:
name: Deploy MkDocs to GitHub Pages
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.10
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Deploy to GitHub Pages
run: mkdocs gh-deploy --force
Authentication¶
To allow gh-deploy
to push to the gh-pages
branch, GitHub automatically provides a token (GITHUB_TOKEN
) in your workflow environment.
No extra setup is required unless you're publishing to a custom repo or organization with restricted permissions.