bengal v #40
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 to GitHub Pages | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| python-version: "3.14t" | |
| - name: Cache uv dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/uv | |
| key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | |
| restore-keys: | | |
| uv-${{ runner.os }}- | |
| - name: Install dependencies | |
| run: uv sync --group dev --group docs | |
| env: | |
| PYTHON_GIL: "0" | |
| # Use bengal cache hash for accurate cache invalidation | |
| # This includes all build inputs: content, config, autodoc sources, templates, etc. | |
| - name: Get cache hash | |
| id: cache | |
| working-directory: site | |
| run: echo "hash=$(uv run bengal cache hash)" >> $GITHUB_OUTPUT | |
| env: | |
| PYTHON_GIL: "0" | |
| - name: Cache Bengal build state | |
| uses: actions/cache@v4 | |
| with: | |
| path: site/.bengal | |
| key: bengal-${{ runner.os }}-${{ steps.cache.outputs.hash }} | |
| # No restore-keys - we want exact match for correctness | |
| - name: Build documentation site | |
| working-directory: site | |
| run: uv run bengal site build --environment production | |
| env: | |
| PYTHON_GIL: "0" | |
| - name: Prepare for upload | |
| run: | | |
| touch site/public/.nojekyll | |
| echo "" > site/public/.gitignore | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: site/public | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - id: deployment | |
| uses: actions/deploy-pages@v4 | |