Skip to content

Build and publish docs #1234

Build and publish docs

Build and publish docs #1234

Workflow file for this run

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@v3
with:
path: pages
- name: Checkout shadow/shadow
uses: actions/checkout@v3
with:
path: shadow
repository: shadow/shadow
- name: Upgrade cargo/rust
run: rustup update
- 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