Skip to content

Commit aa4aba6

Browse files
committed
ci: deploy docs via GitHub Actions to py.sdk.modelcontextprotocol.io
Replace the manual gh-deploy workflow with the GitHub Actions Pages artifact pipeline (configure-pages -> upload-pages-artifact -> deploy-pages) and deploy on push to main. The previous workflow pushed the built site to the gh-pages branch with mkdocs gh-deploy --force. With branch-based Pages, a custom domain only works via a CNAME file in the branch, which a force-push overwrites on every publish. Switching to artifact-based deployment lets the custom domain live as a persistent repository Pages setting instead, so it survives every deploy, and drops the contents: write permission in favour of the scoped pages/id-token tokens. Also point site_url at https://py.sdk.modelcontextprotocol.io/ so canonical links and the sitemap match the SDK's published domain. Closes #2614.
1 parent 161834d commit aa4aba6

3 files changed

Lines changed: 61 additions & 36 deletions

File tree

.github/workflows/deploy-docs.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Deploy Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: deploy-docs
11+
cancel-in-progress: true
12+
13+
jobs:
14+
deploy-docs:
15+
runs-on: ubuntu-latest
16+
17+
permissions:
18+
contents: read
19+
pages: write
20+
id-token: write
21+
22+
environment:
23+
name: github-pages
24+
url: ${{ steps.deployment.outputs.page_url }}
25+
26+
steps:
27+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
28+
29+
- name: Install uv
30+
uses: astral-sh/setup-uv@803947b9bd8e9f986429fa0c5a41c367cd732b41 # v7.2.1
31+
with:
32+
enable-cache: true
33+
version: 0.9.5
34+
35+
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
36+
- uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
37+
with:
38+
key: mkdocs-material-${{ env.cache_id }}
39+
path: .cache
40+
restore-keys: |
41+
mkdocs-material-
42+
43+
- run: uv sync --frozen --group docs
44+
45+
- name: Build docs
46+
run: uv run --frozen --no-sync mkdocs build
47+
env:
48+
ENABLE_SOCIAL_CARDS: "true"
49+
50+
- name: Configure Pages
51+
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
52+
53+
- name: Upload Pages artifact
54+
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
55+
with:
56+
path: site
57+
58+
- name: Deploy to GitHub Pages
59+
id: deployment
60+
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0

.github/workflows/publish-docs-manually.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ strict: true
55
repo_name: modelcontextprotocol/python-sdk
66
repo_url: https://github.com/modelcontextprotocol/python-sdk
77
edit_uri: edit/main/docs/
8-
site_url: https://modelcontextprotocol.github.io/python-sdk
8+
site_url: https://py.sdk.modelcontextprotocol.io/
99

1010
# TODO(Marcelo): Add Anthropic copyright?
1111
# copyright: © Model Context Protocol 2025 to present

0 commit comments

Comments
 (0)