Skip to content

uv testing: trying with GH_TOKEN #79

uv testing: trying with GH_TOKEN

uv testing: trying with GH_TOKEN #79

Workflow file for this run

name: Pages
on:
push:
branches:
- main
# workflow_dispatch allows the site to be rebuilt and published manually if needed
workflow_dispatch:
# 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
concurrency: pages-build-and-deploy
jobs:
build:
runs-on: ubuntu-latest
# Running this action on a fork will likely fail anyway
# unless the forked repo also has access to material for mkdocs insiders
if: github.event.repository.fork == false
env:
# Configure a constant location for the uv cache
UV_CACHE_DIR: /tmp/.uv-cache
steps:
- uses: actions/checkout@v4
- name: Set up uv
# Install a specific uv version using the installer
run: curl -LsSf https://astral.sh/uv/0.3.1/install.sh | sh
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Restore uv cache
uses: actions/cache@v4
with:
path: /tmp/.uv-cache
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}
# Insiders is the sponsorware version of Material for MkDocs
# https://squidfunk.github.io/mkdocs-material/insiders/
- name: Configure auth for Insiders
run: |
echo "https://github:${{ secrets.GH_TOKEN }}@github.com" >> $HOME/.git-credentials
git config --global credential.helper store
- name: Install the project
run: uv sync --all-extras --dev
# The .cache directory is used for 3rd party assets, as part of the privacy plugin.
# It is also used to cache the generated social media cards.
# Persisting the cache across builds dramatically speeds up the process.
- name: Load site cache
uses: actions/cache@v4
with:
key: mkdocs
path: .cache
- name: Build site
run: uv run mkdocs build
# Upload the built site as an artifact, this will be used by the deploy job.
- uses: actions/upload-pages-artifact@v3
with:
path: "site"
- name: Minimize uv cache
run: uv cache prune --ci
deploy:
needs: build
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4