Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 1 addition & 36 deletions .github/workflows/on-release-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ on:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: true

jobs:
set-version:
Expand All @@ -21,7 +15,7 @@ jobs:

- name: Export tag
id: vars
run: echo tag=${GITHUB_REF#refs/*/} >> $GITHUB_OUTPUT
run: printf 'tag=%s\n' "$GITHUB_REF_NAME" >> "$GITHUB_OUTPUT"
if: ${{ github.event_name == 'release' }}

- name: Update project version
Expand Down Expand Up @@ -59,32 +53,3 @@ jobs:
run: uv publish
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}

build-docs:
needs: publish
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955

- name: Set up the environment
uses: ./.github/actions/setup-python-env

- name: Build site
run: uv run mkdocs build -f mkdocs.yml --clean

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
path: site

deploy-docs:
needs: build-docs
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
83 changes: 83 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Publish release docs

on:
workflow_run:
workflows: [release-main]
types: [completed]
workflow_dispatch:
inputs:
release-tag:
description: Published release to build (for example, 1.1.0)
required: true
type: string

permissions:
contents: read

jobs:
build-docs:
# workflow_run runs on the default branch, even when release-main ran on a tag.
if: >-
github.ref == 'refs/heads/main' &&
(github.event_name == 'workflow_dispatch' ||
(github.event.workflow_run.event == 'release' &&
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.head_repository.full_name == github.repository))
runs-on: ubuntu-latest
steps:
- name: Check out main and release history
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955
with:
fetch-depth: 0
persist-credentials: false

- name: Select the release source
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ inputs.release-tag }}
RELEASE_SHA: ${{ github.event.workflow_run.head_sha }}
run: |
if [[ "$GITHUB_EVENT_NAME" == workflow_dispatch ]]; then
git check-ref-format "refs/tags/$RELEASE_TAG"
published_tag=$(gh release view --repo "$GITHUB_REPOSITORY" \
--json isDraft,tagName --jq 'select(.isDraft == false) | .tagName' -- "$RELEASE_TAG")
if [[ "$published_tag" != "$RELEASE_TAG" ]]; then
echo "Select a published GitHub Release." >&2
exit 1
fi
RELEASE_SHA=$(git rev-parse --verify "refs/tags/${RELEASE_TAG}^{commit}")
fi

if ! git merge-base --is-ancestor "$RELEASE_SHA" "$GITHUB_SHA"; then
echo "The release commit must be in the history of main." >&2
exit 1
fi
git checkout --detach "$RELEASE_SHA"

- name: Set up the environment
uses: ./.github/actions/setup-python-env

- name: Build site
run: uv run mkdocs build -f mkdocs.yml --clean

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
path: site

deploy-docs:
needs: build-docs
runs-on: ubuntu-latest
concurrency:
group: pages
cancel-in-progress: false
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
6 changes: 5 additions & 1 deletion docs/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,14 @@ Releases are automated by `on-release-main.yml` once the PR lands on `main`.
2. Publishing the release triggers the workflow, which:
- Syncs the tag back into `pyproject.toml`.
- Builds and uploads to PyPI via `uv publish` using `PYPI_TOKEN`.
- Deploys updated docs with `mkdocs gh-deploy`.
3. After `release-main` succeeds, **Publish release docs** starts on `main`. It builds the MkDocs site from the same commit as the release and deploys it to GitHub Pages. The repository's Pages source is **GitHub Actions**.

No local build/publish steps are needed—just provide a clear release summary (highlights, compatibility notes, migration tips).

## Republish docs for a release

In **Actions → Publish release docs → Run workflow**, select the **`main`** branch and enter the published release tag (for example, `1.1.0`) in **release-tag**. The tag selects the docs to build; the deployment runs from `main`. This does not publish anything to PyPI. After deployment, check that the public quickstart matches the example at the release tag.

## Extra tips

- Breaking schema bumps often mean updating `tests/test_golden.py`, `tests/test_rpc.py`, and any examples touched by new fields.
Expand Down
Loading