Build and publish docs #882
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
# Run cmake to generate shd-config.h | |
- name: Run cmake | |
run: | | |
sudo apt-get install cmake | |
cmake -S shadow -B shadow/build | |
- name: Build rustdoc | |
run: cd shadow/src && cargo doc | |
- 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 |