Repository navigation
92 lines (81 loc) · 3.3 KB
/
Copy pathdocs.yml
File metadata and controls
92 lines (81 loc) · 3.3 KB
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
name: Documentation
on:
# Build validation on PRs
pull_request:
paths:
- 'docs/**'
- 'website/**'
- '.github/workflows/docs.yml'
# Deploy on push to main
push:
branches:
- main
paths:
- 'docs/**'
- 'website/**'
- '.github/workflows/docs.yml'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# Tags are needed by the "Resolve docs version" step below; the
# default shallow checkout fetches none, and `git describe` would
# silently return empty and hide the version badge.
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: website/package-lock.json
- name: Install dependencies
working-directory: website
run: npm ci
# The navbar version badge reads DOCS_VERSION. Without it the config
# falls back to hiding the badge, which is why the site used to render
# the literal string "v__VERSION__": the `sed` that substitutes it runs
# only in release.yml's deploy-docs job, never in this one — and this one
# deploys the same mcpproxy-docs project on every push to main.
#
# --exclude '*-*' keeps prerelease tags out. RCs are tagged on main
# (v0.65.0-rc.1), they match 'v[0-9]*', and `git describe` picks the
# nearest tag reachable from HEAD — so without this a docs deploy from
# main would badge the stable site with an RC. release.yml's deploy-docs
# job applies the same rule via `!contains(github.ref_name, '-')`.
- name: Resolve docs version
id: docs_version
run: |
VERSION="$(git describe --tags --abbrev=0 --match 'v[0-9]*' --exclude '*-*' 2>/dev/null || true)"
echo "value=${VERSION}" >> "$GITHUB_OUTPUT"
echo "Docs version badge: ${VERSION:-<hidden>}"
- name: Build documentation
working-directory: website
env:
DOCS_VERSION: ${{ steps.docs_version.outputs.value }}
run: npm run build
- name: Verify build output
run: |
if [ ! -f website/build/index.html ]; then
echo "::error::Documentation build failed - no index.html found"
exit 1
fi
if [ ! -f website/build/llms.txt ]; then
echo "::warning::llms.txt not generated"
fi
echo "Documentation build successful!"
echo "Build size: $(du -sh website/build | cut -f1)"
echo "Pages: $(find website/build -name '*.html' | wc -l)"
# Deploy to Cloudflare Pages on push to main (skipped for forks/PRs)
- name: Deploy to Cloudflare Pages
if: |
github.event_name == 'push' &&
github.ref == 'refs/heads/main' &&
github.repository == 'smart-mcp-proxy/mcpproxy-go'
uses: cloudflare/wrangler-action@953926a2e2182532811c01a25e53647d93bf07c0 # v4.1.3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy website/build --project-name=mcpproxy-docs
continue-on-error: true