Skip to content

Commit dc134d9

Browse files
docs: add workflow to create and publish docs
1 parent ac0a637 commit dc134d9

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

.github/workflows/docs.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: "build and deploy docs to github pages"
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
pull_request:
8+
branches: [main]
9+
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
concurrency:
16+
group: deploy
17+
cancel-in-progress: false
18+
19+
jobs:
20+
build:
21+
name: Build
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
27+
- name: Setup Rust
28+
uses: dtolnay/rust-toolchain@nightly
29+
with:
30+
targets: x86_64-unknown-none
31+
32+
- name: Add components
33+
run: rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
34+
35+
- name: Configure cache
36+
uses: Swatinem/rust-cache@v2
37+
38+
- name: Setup pages
39+
id: pages
40+
uses: actions/configure-pages@v5
41+
42+
- name: Clean docs folder
43+
run: cargo clean --doc -Z bindeps
44+
45+
- name: Build docs
46+
run: cd src/kernel && cargo doc -Zbuild-std --no-deps --document-private-items
47+
48+
- name: Add redirect
49+
run: echo '<meta http-equiv="refresh" content="0;url=kernel/index.html">' > target/x86_64-unknown-none/doc/index.html
50+
51+
- name: Remove lock file
52+
run: rm target/x86_64-unknown-none/doc/.lock
53+
54+
- name: Upload artifact
55+
uses: actions/upload-pages-artifact@v3
56+
with:
57+
path: target/x86_64-unknown-none/doc
58+
59+
deploy:
60+
name: Deploy
61+
environment:
62+
name: github-pages
63+
url: ${{ steps.deployment.outputs.page_url }}
64+
runs-on: ubuntu-latest
65+
needs: build
66+
steps:
67+
- name: Deploy to GitHub Pages
68+
id: deployment
69+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)