-
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (69 loc) · 2.31 KB
/
docs.yml
File metadata and controls
82 lines (69 loc) · 2.31 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
name: Documentation
on:
push:
branches: [main]
paths:
- 'docs/**'
- '**/src/**/*.rs'
- '**/Cargo.toml'
workflow_dispatch:
permissions:
contents: write
jobs:
# Build and deploy rustdoc
rustdoc:
name: Build Rustdoc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Build documentation
run: cargo doc --workspace --no-deps --all-features
- name: Add index redirect
run: echo '<meta http-equiv="refresh" content="0; url=stranddb">' > target/doc/index.html
- name: Deploy to GitHub Pages
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/doc
destination_dir: api
# Deploy user documentation
deploy-docs:
name: Deploy User Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Detect user docs
id: detect
shell: bash
run: |
set -euo pipefail
if [ -f docs/package.json ]; then
echo "has_docs=true" >> "$GITHUB_OUTPUT"
else
echo "has_docs=false" >> "$GITHUB_OUTPUT"
echo "No ./docs/package.json found; skipping user docs deploy."
fi
- name: Setup Node.js
if: ${{ github.event_name == 'workflow_dispatch' && steps.detect.outputs.has_docs == 'true' }}
uses: actions/setup-node@v6
with:
node-version: '20'
- name: Install dependencies
if: ${{ github.event_name == 'workflow_dispatch' && steps.detect.outputs.has_docs == 'true' }}
run: |
cd docs
npm install
- name: Build documentation site
if: ${{ github.event_name == 'workflow_dispatch' && steps.detect.outputs.has_docs == 'true' }}
run: |
cd docs
npm run build
- name: Deploy to GitHub Pages
if: ${{ github.event_name == 'workflow_dispatch' && steps.detect.outputs.has_docs == 'true' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build