Merge pull request #10 from DMontgomery40/cleanup #7
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
| # Publish MkDocs documentation using mike for versioning | |
| # | |
| # Triggers: | |
| # - Push to main branch (paths: mkdocs.yml, mkdocs/**) | |
| # - Manual workflow dispatch | |
| # | |
| # Deploys to gh-pages branch using mike for version management | |
| name: Publish MkDocs (mike) | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'mkdocs.yml' | |
| - 'mkdocs/**' | |
| workflow_dispatch: | |
| inputs: | |
| regenerate_docs: | |
| description: 'Regenerate docs using AI (requires OPENAI_API_KEY secret)' | |
| required: false | |
| default: 'false' | |
| type: boolean | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Full history for mike versioning | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install mkdocs==1.6.1 mkdocs-material==9.7.1 pymdown-extensions==10.7.1 | |
| pip install mike==2.1.0 mkdocs-git-revision-date-localized-plugin==1.2.6 mkdocs-minify-plugin==0.8.0 | |
| pip install mkdocs-glightbox openai requests pyyaml # For docs regeneration | |
| - name: Regenerate docs with AI (optional) | |
| if: ${{ github.event.inputs.regenerate_docs == 'true' }} | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| run: | | |
| echo "Regenerating documentation using AI..." | |
| python scripts/docs_ai/docs_autopilot_enhanced.py --regenerate-all | |
| # Commit regenerated docs | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add mkdocs/docs/ | |
| git diff --cached --quiet || git commit -m "docs: regenerate documentation with AI" | |
| - name: Build documentation (sanity check) | |
| run: mkdocs build --strict | |
| - name: Configure git author | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Deploy latest to gh-pages | |
| run: | | |
| mike deploy --push --remote origin --branch gh-pages latest | |
| mike set-default --push --remote origin --branch gh-pages latest |