forked from DigiLive/mushroom-strategy
The workflow for deploying the documentation wasn't triggered on PRs. In that case, the PR's status check will keep waiting infinitely.
57 lines
1.4 KiB
YAML
57 lines
1.4 KiB
YAML
name: Deploy Documentation
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
check-for-docs-changes:
|
|
name: Check for Docs Changes
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
# Output a boolean indicating if any relevant files have changed
|
|
docs_changed: ${{ steps.check_files.outputs.any_changed }}
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Check for changed files in docs folder or mkdocs.yml
|
|
id: check_files
|
|
uses: tj-actions/changed-files@v46
|
|
with:
|
|
files: |
|
|
docs/**
|
|
mkdocs.yml
|
|
|
|
deploy:
|
|
name: Deploy MkDocs Site
|
|
runs-on: ubuntu-latest
|
|
needs: check-for-docs-changes
|
|
if: needs.check-for-docs-changes.outputs.docs_changed == 'true'
|
|
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.x' # Use a specific version like '3.10', '3.11', or '3.12'
|
|
|
|
- name: Install MkDocs, Material for MkDocs, and PyMdown Extensions
|
|
run: pip install mkdocs mkdocs-material pymdown-extensions
|
|
|
|
- name: Deploy Docs to GitHub Pages
|
|
run: mkdocs gh-deploy --force --clean
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}
|