fix(CI): docs workflow #5
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: Build and Deploy Documentation | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| UV_SYSTEM_PYTHON: 1 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Set up Python | |
| run: uv python install | |
| - name: Install the project | |
| run: | | |
| uv sync --locked --all-extras --dev | |
| - name: Build documentation | |
| run: sphinx-build -b html docs/source docs/build/ | |
| - name: Commit and Stash Documentation | |
| run: | | |
| git add -f docs/build/ | |
| git stash | |
| - name: Checkout gh-pages | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: gh-pages | |
| - name: Configure Git | |
| run: | | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| - name: Cleanup Old Folders | |
| run: | | |
| rm -rf _static/ | |
| rm -rf _modules/ | |
| rm -rf _sources/ | |
| rm -rf examples/ | |
| rm -rf modules/ | |
| - name: Deploy to gh-pages | |
| run: | | |
| git stash pop | |
| mv -f docs/build/* . | |
| rm -rf docs/build | |
| git add . | |
| git commit -m "Auto update docs" | |
| git push |