-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (73 loc) Β· 2.09 KB
/
docs.yml
File metadata and controls
77 lines (73 loc) Β· 2.09 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
name: Documentation
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
workflow_dispatch:
jobs:
build-docs:
name: Build Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rust-docs
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build docs
run: cargo doc --workspace --no-deps
- name: Upload docs artifact
uses: actions/upload-artifact@v4
with:
name: rust-docs
path: target/doc
retention-days: 30
check-doc-comments:
name: Check Documentation Comments
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rust-docs
- name: Run cargo doc
run: cargo doc --workspace --document-private-items 2>&1 | tee doc-output.txt
- name: Check for missing docs
run: |
if grep -q "missing documentation" doc-output.txt; then
echo "Missing documentation found!"
grep "missing documentation" doc-output.txt | head -20
exit 1
else
echo "All documented items have documentation."
fi
deploy-gh-pages:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
needs: build-docs
if: github.ref == 'refs/heads/main'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download docs artifact
uses: actions/download-artifact@v4
with:
name: rust-docs
path: ./public
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
keep_files: false