-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (53 loc) · 1.8 KB
/
build.yaml
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
name: Build and publish docs
on:
schedule:
# once per day
- cron: "0 0 * * *"
# run manually from the GitHub Actions webpage
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: pages
- name: Checkout shadow/shadow
uses: actions/checkout@v4
with:
path: shadow
repository: shadow/shadow
persist-credentials: false
- name: Upgrade cargo/rust
run: rustup update
- name: Install dependencies
run: sudo apt-get install -y libglib2.0-dev
- name: Build rustdoc
run: |
# don't build docs for shadow's tests
(cd shadow/src && cargo doc --workspace --exclude shadow-tests)
# rebuild docs for main shadow crate, but with custom version string (shown at top-left of webpage)
(cd shadow/src/main && RUSTDOCFLAGS="--crate-version $(git rev-parse --short HEAD)" cargo rustdoc)
- name: Copy rustdoc
run: |
rm -rf pages/docs
mkdir pages/docs
mv shadow/src/target/doc pages/docs/rust
echo '<meta http-equiv="refresh" content="0; url=/docs/rust/shadow_rs/">' > pages/docs/rust/index.html
- name: Build guide
run: |
cargo install --vers "^0.4" mdbook
mdbook build --dest-dir ../../pages/docs/guide shadow/mdbook
echo '<meta http-equiv="refresh" content="0; url=/docs/guide/">' > pages/docs/index.html
- name: Commit
run: |
COMMIT="$(cd shadow && git rev-parse --short HEAD)"
cd pages
git config user.name github-actions
git config user.email [email protected]
git add .
git diff-index --quiet HEAD || git commit -m "Generated docs for shadow/shadow@$COMMIT"
git push