1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Publish documentation
on:
push:
branches:
paths:
- "docs/**"
- "src/**"
- "README.md"
- "Cargo.toml"
- "rust-toolchain.toml"
- ".github/workflows/docs.yml"
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
env:
RUSTDOCFLAGS: -Dwarnings
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out source
uses: actions/checkout@v7
- name: Configure GitHub Pages
uses: actions/configure-pages@v6
- name: Install Node.js 24
uses: actions/setup-node@v7
with:
node-version: 24
cache: npm
cache-dependency-path: docs/package-lock.json
- name: Cache VitePress build data
uses: actions/cache@v6
with:
path: docs/.vitepress/cache
key: ${{ runner.os }}-vitepress-${{ hashFiles('docs/package-lock.json', 'docs/**/*.md', 'docs/.vitepress/**') }}
restore-keys: |
${{ runner.os }}-vitepress-
- name: Install exact VitePress dependency
working-directory: docs
run: npm ci --no-audit --no-fund
- name: Check documentation formatting
working-directory: docs
run: npm run format:check
- name: Build VitePress documentation
working-directory: docs
run: npm run docs:build
- name: Install Rust 1.97.1
run: |
rustup toolchain install 1.97.1 --profile minimal
rustup default 1.97.1
- name: Generate Rust API documentation
run: cargo doc --no-deps --all-features
- name: Add Rustdoc to the site
run: |
mkdir -p docs/.vitepress/dist/rustdoc
cp -a target/doc/. docs/.vitepress/dist/rustdoc/
cat > docs/.vitepress/dist/rustdoc/index.html <<'EOF'
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="refresh" content="0; url=./modelcontextprotocol/index.html">
<link rel="canonical" href="./modelcontextprotocol/index.html">
<title>modelcontextprotocol Rust API documentation</title>
</head>
<body>
<p><a href="./modelcontextprotocol/index.html">Open the Rust API documentation</a></p>
</body>
</html>
EOF
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v5
with:
path: docs/.vitepress/dist
deploy:
name: Deploy to GitHub Pages
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy documentation
id: deployment
uses: actions/deploy-pages@v5