editor config #454
This file contains 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 pages | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
env: | |
UV_CACHE_DIR: /tmp/.uv-cache | |
UV_SYSTEM_PYTHON: 1 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # full history | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
id: setup-python | |
with: | |
python-version: '3.x' | |
- name: Install uv | |
run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
- name: uv cache | |
uses: actions/cache@v4 | |
if: ${{ contains(runner.name, 'GitHub Actions') }} | |
with: | |
path: /tmp/.uv-cache | |
key: uv-${{ runner.os }}-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
uv-${{ runner.os }}- | |
- name: Install Python dependencies | |
run: uv pip install -r requirements.txt | |
- name: Setup Pages | |
id: pages | |
uses: actions/configure-pages@v5 | |
- name: Build website | |
env: | |
SITE_URL: ${{ steps.pages.outputs.base_url }} | |
REPO_URL: ${{ github.server_url }}/${{ github.repository }} | |
REPO_NAME: ${{ github.repository }} | |
run: uv run mkdocs build | |
- name: Minimize uv cache | |
run: uv cache prune --ci | |
- name: Upload page artifact | |
if: ${{ github.ref == 'refs/heads/main'}} | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./site | |
# Deployment job | |
deploy: | |
needs: build | |
if: ${{ github.ref == 'refs/heads/main' }} | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
actions: read # to download an artifact uploaded by `actions/upload-pages-artifact@v3` | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |