Skip to content

猬嗭笍(deps-dev): Bump the python-root group across 1 directory with 2 updates #354

猬嗭笍(deps-dev): Bump the python-root group across 1 directory with 2 updates

猬嗭笍(deps-dev): Bump the python-root group across 1 directory with 2 updates #354

Workflow file for this run

# Docs build + deploy for both mirrors of this repo. Target is chosen at runtime
# from github.server_url:
# * github.com -> versioned GitHub Pages (mike)
# * otherwise -> an internal docs host (static upload)
# Internal host details come from repo variables (DOCS_HOST / DOCS_RESOLVE_IP),
# which are empty on github.com, so that path is skipped and nothing
# environment-specific is committed.
name: Docs
on:
push:
branches: [main, master]
paths:
- "docs/**"
- "mkdocs.yml"
- "configs/**"
- "apps/mewbo_api/**"
- "packages/mewbo_graph/**"
- "packages/mewbo_core/src/mewbo_core/config.py"
- "scripts/ci/generate_openapi_spec.py"
- "scripts/ci/generate_config_schema.py"
# The docs theme is a pinned wheel, so a theme upgrade changes only these
# two files. Without them a pin bump publishes nothing and the deployed
# site keeps serving the previous theme with no failure anywhere.
- "pyproject.toml"
- "uv.lock"
- ".github/workflows/docs.yml"
pull_request:
types: [opened, synchronize, reopened, closed]
paths:
- "docs/**"
- "mkdocs.yml"
- "configs/**"
- "apps/mewbo_api/**"
- "packages/mewbo_graph/**"
- "packages/mewbo_core/src/mewbo_core/config.py"
- "scripts/ci/generate_openapi_spec.py"
- "scripts/ci/generate_config_schema.py"
# The docs theme is a pinned wheel, so a theme upgrade changes only these
# two files. Without them a pin bump publishes nothing and the deployed
# site keeps serving the previous theme with no failure anywhere.
- "pyproject.toml"
- "uv.lock"
- ".github/workflows/docs.yml"
workflow_dispatch:
permissions:
contents: write # mike pushes the gh-pages branch
concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true
env:
DOCS_HOST: ${{ vars.DOCS_HOST }}
DOCS_RESOLVE_IP: ${{ vars.DOCS_RESOLVE_IP }}
jobs:
deploy:
name: Build & deploy docs
if: >-
github.event.action != 'closed' &&
(github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip uv
# The wiki extra pulls mewbo-graph, so the spec published from here is
# generated in the same shape as the committed one rather than
# depending on every graph import in the api staying guarded.
uv sync --group docs --extra ha --extra api --extra wiki
- name: Prepare docs inputs
run: |
printf '{"commit":"%s"}\n' "$(git rev-parse --short HEAD)" > docs/build-info.json
# Both generators exit 0 whether the artifact was rewritten or already
# current, and non-zero only on a genuine failure, so neither call is
# masked. While they were masked a broken export was indistinguishable
# from a clean one and the site kept publishing the committed schema
# and spec regardless, so an API change that was never regenerated
# locally shipped stale docs with no signal anywhere.
uv run python scripts/ci/generate_config_schema.py
cp configs/app.schema.json docs/app.schema.json
uv run python scripts/ci/generate_openapi_spec.py
# --- github.com: versioned GitHub Pages via mike ---
- name: Configure git (mike)
if: github.server_url == 'https://github.com'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Publish to GitHub Pages
if: github.server_url == 'https://github.com' && github.ref_name == github.event.repository.default_branch
run: |
# Version label is derived from the branch that was pushed, so the
# same workflow publishes "master" on the GitHub mirror and "main"
# on the Gitea origin without hardcoding either name.
uv run mike deploy --push --update-aliases "${{ github.ref_name }}" latest --alias-type copy
uv run mike set-default --push latest
- name: Publish PR preview to GitHub Pages
if: >-
github.server_url == 'https://github.com' &&
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository &&
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) &&
!contains(github.actor, '[bot]')
run: uv run mike deploy --push "pr-${{ github.event.pull_request.number }}"
# --- internal docs host: single version, static upload ---
- name: Publish to internal docs host
if: github.server_url != 'https://github.com'
run: |
slug="assistant"
[ "${{ github.event_name }}" = "pull_request" ] && slug="assistant-pr-${{ github.event.pull_request.number }}"
sed -i "s|^site_url:.*|site_url: https://${DOCS_HOST}/${slug}/|" mkdocs.yml
uv run python -m mkdocs build -d site
tar -C site -cf site.tar .
curl -fsS -k --retry 5 --retry-all-errors --retry-delay 4 --max-time 180 \
--resolve "${DOCS_HOST}:443:${DOCS_RESOLVE_IP}" \
-X PUT -H 'Content-Type: application/x-tar' --data-binary @site.tar \
"https://${DOCS_HOST}/${slug}/"
cleanup:
name: Remove internal-host PR preview
# Remove a PR preview from the internal docs host when the PR closes.
# (GitHub Pages / mike PR cleanup lives in docs-cleanup.yml.)
if: >-
github.server_url != 'https://github.com' &&
github.event_name == 'pull_request' &&
github.event.action == 'closed'
runs-on: ubuntu-latest
steps:
- name: Remove PR preview
run: |
curl -fsS -k --retry 3 --retry-all-errors --retry-delay 4 \
--resolve "${DOCS_HOST}:443:${DOCS_RESOLVE_IP}" \
-X DELETE "https://${DOCS_HOST}/assistant-pr-${{ github.event.pull_request.number }}/" || true