ci: pick the docs-preview toolchain from the PR checkout (#3081)
This commit is contained in:
parent
148278e07f
commit
74a242ae7f
1 changed files with 27 additions and 12 deletions
39
.github/workflows/docs-preview.yml
vendored
39
.github/workflows/docs-preview.yml
vendored
|
|
@ -1,13 +1,14 @@
|
||||||
name: Docs Preview
|
name: Docs Preview
|
||||||
|
|
||||||
# Builds the mkdocs site for a PR and deploys it to Cloudflare Pages.
|
# Builds the docs site for a PR and deploys it to Cloudflare Pages.
|
||||||
#
|
#
|
||||||
# Security: mkdocs executes Python from the PR (mkdocstrings imports src/mcp,
|
# Security: the build executes Python from the PR (mkdocstrings imports
|
||||||
# `!!python/name:` directives). The build is gated by `authorize` (admin sender
|
# src/mcp, `!!python/name:` config directives run, and heads may ship their
|
||||||
# for auto-preview, admin/maintainer commenter for /preview-docs) and isolated
|
# own build scripts). The build is gated by `authorize` (admin sender for
|
||||||
# from Cloudflare secrets — `build` runs PR code with no secrets and hands the
|
# auto-preview, admin/maintainer commenter for /preview-docs) and isolated
|
||||||
# static site to `deploy` via an artifact, so PR code never shares a runner
|
# from Cloudflare secrets — `build` runs PR code with no secrets and hands
|
||||||
# with the Cloudflare token.
|
# the static site to `deploy` via an artifact, so PR code never shares a
|
||||||
|
# runner with the Cloudflare token.
|
||||||
#
|
#
|
||||||
# Required configuration:
|
# Required configuration:
|
||||||
# - secrets.CLOUDFLARE_API_TOKEN (scope: Account → Cloudflare Pages → Edit)
|
# - secrets.CLOUDFLARE_API_TOKEN (scope: Account → Cloudflare Pages → Edit)
|
||||||
|
|
@ -21,6 +22,7 @@ on:
|
||||||
- docs/**
|
- docs/**
|
||||||
- docs_src/**
|
- docs_src/**
|
||||||
- mkdocs.yml
|
- mkdocs.yml
|
||||||
|
- scripts/docs/**
|
||||||
- pyproject.toml
|
- pyproject.toml
|
||||||
issue_comment:
|
issue_comment:
|
||||||
types: [created]
|
types: [created]
|
||||||
|
|
@ -128,17 +130,30 @@ jobs:
|
||||||
enable-cache: false
|
enable-cache: false
|
||||||
version: 0.9.5
|
version: 0.9.5
|
||||||
|
|
||||||
- run: uv sync --frozen --group docs
|
# pull_request_target runs this workflow file from the base branch, so
|
||||||
- run: uv run --frozen --no-sync mkdocs build
|
# the whole recipe — dependency sync included — must come from the
|
||||||
env:
|
# checkout itself: heads that ship scripts/docs/build.sh (the Zensical
|
||||||
# Silence mkdocs-material's MkDocs 2.0 warning banner in CI logs.
|
# toolchain) build with it; older heads, and v1.x heads previewed via
|
||||||
NO_MKDOCS_2_WARNING: "1"
|
# /preview-docs, still build with MkDocs. Both arms must write the site
|
||||||
|
# to site/. Keep the detection in sync with build_site() in
|
||||||
|
# scripts/build-docs.sh.
|
||||||
|
- run: |
|
||||||
|
if [ -f scripts/docs/build.sh ]; then
|
||||||
|
bash scripts/docs/build.sh
|
||||||
|
else
|
||||||
|
uv sync --frozen --group docs
|
||||||
|
# The env var silences mkdocs-material's MkDocs 2.0 warning banner.
|
||||||
|
NO_MKDOCS_2_WARNING=1 uv run --frozen --no-sync mkdocs build
|
||||||
|
fi
|
||||||
|
|
||||||
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||||
with:
|
with:
|
||||||
name: site
|
name: site
|
||||||
path: site/
|
path: site/
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
# An empty site/ means the build arm broke its output contract; fail
|
||||||
|
# here instead of surfacing as a confusing download error in deploy.
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
needs: [authorize, build]
|
needs: [authorize, build]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue