Deploy MkDocs to GitHub Pages #1090
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy MkDocs to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - main # Deploy when changes are pushed to the main branch | |
| # Also deploy after discussion links are synced | |
| workflow_run: | |
| workflows: ["Sync Discussion Links"] | |
| types: | |
| - completed | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| # Only run if triggered by push or if the workflow_run was successful | |
| if: github.event_name == 'push' || github.event.workflow_run.conclusion == 'success' | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| # When triggered by workflow_run, we need to checkout the latest main branch | |
| ref: ${{ github.event_name == 'workflow_run' && 'main' || github.ref }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.9' # Specify the Python version | |
| - name: Install Dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| - name: Update mkdocs.yml | |
| run: | | |
| python update_mkdocs.py | |
| - name: Build and Deploy MkDocs | |
| run: | | |
| mkdocs gh-deploy --force |