Skip to content

Deploy MkDocs to GitHub Pages #31

Deploy MkDocs to GitHub Pages

Deploy MkDocs to GitHub Pages #31

Workflow file for this run

name: Deploy MkDocs to GitHub Pages
on:
workflow_run:
workflows: ["Test"]
types:
- completed
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
name: Build Website
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Use the head_sha of the workflow_run to get the correct commit
ref: ${{ github.event.workflow_run.head_sha }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install uv
run: |
python -m pip install --upgrade pip
pip install uv
- name: Install dependencies
run: |
uv sync --frozen
- name: Build MkDocs
run: |
uv run mkdocs build --verbose --clean --strict
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./site
deploy:
name: Deploy to GitHub Pages
# Only deploy if it's the main branch and build succeeded
if: >
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.head_branch == 'main'
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4