Skip to content

Build and Deploy Docs #11

Build and Deploy Docs

Build and Deploy Docs #11

Workflow file for this run

name: Build and Deploy Docs
on:
push:
branches:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
workflow_dispatch: # Allow manual triggering
jobs:
deploy:
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- name: Install and Build
if: github.event.action != 'closed'
run: |
cd docs
pip install -r requirements.txt
# Deploy with pr-preview only on PRs
- name: Deploy preview
if: github.event_name == 'pull_request'
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./docs/site
# Deploy to GitHub Pages only when the main branch
- name: Deploy to GitHub Pages
run : |
cd docs
mkdocs gh-deploy --force
if: github.ref == 'refs/heads/main' && github.event_name == 'push'