Repository navigation
130 lines (123 loc) · 3.52 KB
/
Copy pathdocs.yml
File metadata and controls
130 lines (123 loc) · 3.52 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Documentation
on:
pull_request:
paths:
- "docs/**"
- "mkdocs_hooks.py"
- "mkdocs.yml"
- "pyproject.toml"
- "uv.lock"
- "Cargo.toml"
- "Cargo.lock"
- "rust-toolchain.toml"
- "crates/libsy/**"
- "crates/libsy-llm-client/**"
- "crates/switchyard-runner/**"
- "crates/protocol/**"
- "crates/switchyard-translation/**"
- ".github/workflows/docs.yml"
push:
branches: [main]
paths:
- "docs/**"
- "mkdocs_hooks.py"
- "mkdocs.yml"
- "pyproject.toml"
- "uv.lock"
- "Cargo.toml"
- "Cargo.lock"
- "rust-toolchain.toml"
- "crates/libsy/**"
- "crates/libsy-llm-client/**"
- "crates/switchyard-runner/**"
- "crates/protocol/**"
- "crates/switchyard-translation/**"
- ".github/workflows/docs.yml"
# Cancel superseded PR runs; keep main builds so gh-pages writes don't race.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
MKDOCS_SOURCE_REF: ${{ github.event.pull_request.head.sha || github.sha }}
permissions:
contents: read
jobs:
build:
name: Build docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
with:
python-version: "3.12"
enable-cache: true
cache-dependency-glob: "uv.lock"
- run: uv sync --only-group docs --locked
- name: Build documentation
run: uv run --only-group docs mkdocs build --strict
- name: Build Rust crate documentation
env:
RUSTDOCFLAGS: -D warnings
run: >-
cargo doc --locked --no-deps
--package switchyard-libsy
--package switchyard-protocol
--package switchyard-translation
--package switchyard-llm-client
--package switchyard-runner
- name: Add crate documentation to site
run: |
mkdir -p site/rust
cp -R target/doc/. site/rust/
- name: Upload site artifact
uses: actions/upload-artifact@v4
with:
name: docs-site
path: site/
retention-days: 1
deploy:
name: Deploy to GitHub Pages
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download site artifact
uses: actions/download-artifact@v4
with:
name: docs-site
path: site/
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
keep_files: true
# Fork PRs can't write to gh-pages with GITHUB_TOKEN, so the preview is
# gated to same-repo PRs.
preview:
name: Deploy PR preview
needs: build
if: >-
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Download site artifact
uses: actions/download-artifact@v4
with:
name: docs-site
path: site/
- name: Deploy PR preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./site
preview-branch: gh-pages
umbrella-dir: pr-preview
action: auto
qr-code: false