Skip to content

Update main.yml

Update main.yml #47

Workflow file for this run

name: docsbuild
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write # required to push to gh-pages
concurrency:
group: docsbuild-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# ----------------------------------------------------------------------
# CHECKOUT
# ----------------------------------------------------------------------
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # mkdocs gh-deploy needs full history
# ----------------------------------------------------------------------
# PYTHON SETUP
# ----------------------------------------------------------------------
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Cache pip dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('mkdocs.yml') }}
restore-keys: |
${{ runner.os }}-pip-
# ----------------------------------------------------------------------
# INSTALL DEPENDENCIES
# ----------------------------------------------------------------------
- name: Install MkDocs and plugins
run: |
python -m pip install -U pip
pip install \
mkdocs \
mkdocs-material>=9.5 \
mkdocs-material-extensions>=1.4 \
pymdown-extensions>=10.6 \
mkdocs-table-reader-plugin
# ----------------------------------------------------------------------
# BUILD (STRICT)
# ----------------------------------------------------------------------
- name: Build MkDocs site
run: |
mkdocs build --strict 2> build-warnings.txt || true
# Optional: Capture any warnings (broken links, etc.)
- name: Upload build warnings
if: always()
uses: actions/upload-artifact@v4
with:
name: build-warnings
path: build-warnings.txt
# ----------------------------------------------------------------------
# DEPLOY
# ----------------------------------------------------------------------
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
publish_branch: gh-pages