-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (53 loc) · 1.53 KB
/
docs.yml
File metadata and controls
61 lines (53 loc) · 1.53 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
name: Deploy docs to GitHub Pages
on:
push:
branches:
- main # Run on pushes to `main`
- dev # Run on pushes to `dev`
permissions:
id-token: write
pages: write
contents: read
jobs:
build:
name: Build Rust docs
runs-on: ubuntu-latest
steps:
# Step 1: Checkout Repository
- name: Checkout Repository
uses: actions/checkout@v4
# Step 2: Install Rust
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
# https://stackoverflow.com/questions/78629554/how-to-cache-cargo-packages-in-the-github-ci-workflow
- name: "Cache cargo"
id: cache-cargo
uses: "actions/cache@v4"
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
save-always: true
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
# Step 3: Generate Rust Documentation
- name: Build Rust Documentation
run: cargo doc --no-deps --workspace
# Step 4: Upload Build Artifacts
- name: Upload Build Artifacts
uses: actions/upload-pages-artifact@v3
with:
path: target/doc
deploy:
environment:
name: github-pages
runs-on: ubuntu-latest
needs: build # This job depends on the "build" job
steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4