-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (65 loc) · 2.4 KB
/
Copy pathdocs.yml
File metadata and controls
76 lines (65 loc) · 2.4 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
# Build rustdoc for the workspace and publish it to the `gh-pages`
# branch. Triggers on every push to `master` and on manual dispatch.
#
# Conventions:
# - `force_orphan: true` keeps `gh-pages` at a single rolling commit
# (no binary-churn history bloat).
# - `.nojekyll` disables Jekyll so rustdoc's `_underscore`-prefixed
# files (search index, theme bits) are served verbatim.
# - The landing `index.html` is generated by scanning `target/doc/*/`
# for every documented crate — no hardcoded crate name. New crates
# appear on the landing page automatically.
name: Docs
on:
push:
branches: [master]
workflow_dispatch:
permissions:
contents: write
concurrency:
group: gh-pages
cancel-in-progress: false
jobs:
deploy:
name: Build & deploy rustdoc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build rustdoc
run: cargo doc --workspace --no-deps
- name: Copy logo + write minimal index + disable Jekyll
run: |
# Logo at /logo.png — referenced from every crate via
# `#![doc(html_logo_url = "https://qlrd.github.io/kdk/logo.png")]`.
cp assets/logo.png target/doc/logo.png
# Minimal index — bare list of documented crates. Each crate
# page already renders the KDK logo in its sidebar via
# `html_logo_url`, so this page only needs to point at them.
cat > target/doc/index.html <<'HEAD'
<!DOCTYPE html>
<meta charset="utf-8">
<title>KDK</title>
<ul>
HEAD
for d in target/doc/*/; do
crate=$(basename "$d")
if [ -f "${d}index.html" ]; then
printf '<li><a href="./%s/index.html">%s</a></li>\n' "$crate" "$crate" >> target/doc/index.html
fi
done
cat >> target/doc/index.html <<'TAIL'
</ul>
TAIL
touch target/doc/.nojekyll
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/doc
publish_branch: gh-pages
force_orphan: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
commit_message: 'docs: rebuild from ${{ github.sha }}'