Skip to content

Deploy MkDocs to GitHub Pages #2

Deploy MkDocs to GitHub Pages

Deploy MkDocs to GitHub Pages #2

Workflow file for this run

name: Deploy MkDocs to GitHub Pages
on:
push:
branches:
- master
- main
# Allow manual triggering
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Cache dependencies
uses: actions/cache@v4
with:
key: ${{ github.ref }}
path: .cache
# Debug: List files in repository
- name: Debug - List files
run: ls -la
# Install all dependencies
- name: Install MkDocs and dependencies
run: |
python -m pip install --upgrade pip
pip install mkdocs==1.5.3
pip install mkdocs-material
pip install mkdocs-simple-hooks
pip install pillow cairosvg
# Debug: Print installed MkDocs version
- name: Debug - Print MkDocs version
run: mkdocs --version
# Debug: Print mkdocs.yml content
- name: Debug - Print mkdocs.yml content
run: cat mkdocs.yml
# Build the MkDocs site
- name: Build MkDocs site
run: mkdocs build --verbose
# Debug: List built site files
- name: Debug - List site files
run: ls -la site
# Setup Pages
- name: Setup Pages
uses: actions/configure-pages@v4
# Upload artifact
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./site
# Deploy job
deploy:
# Add a dependency to the build job
needs: build
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4