Related work writing. #10
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: Publish | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
publish: | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
steps: | |
- id: checkout | |
name: Checkout | |
uses: actions/checkout@v3 | |
- id: setup-rust | |
name: Setup Rust | |
uses: ATiltedTree/setup-rust@v1 | |
with: | |
rust-version: stable | |
# Caching for Cargo | |
- id: cache-cargo | |
name: Cache Cargo | |
uses: actions/cache@v3 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
# Run stepper to verify that tutorial code works, and to generate diffs. | |
- id: run-stepper | |
name: Run stepper | |
run: cargo run --bin stepper -- --debug | |
- id: setup-mdbook | |
name: Setup mdBook | |
uses: peaceiris/actions-mdbook@v1 | |
with: | |
mdbook-version: '0.4.34' | |
- id: install-cargo-binstall | |
name: Install cargo-binstall | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-binstall | |
# Copy files for hashing in the next step, as `hashFiles` only works inside the workspace, not the home directory. | |
- id: copy-files-for-hashing | |
name: Copy files for hashing into workspace | |
run: | | |
cp ~/.cargo/.crates.toml .crates.toml.hash | |
cp ~/.cargo/.crates2.json .crates2.json.hash | |
# Caching for cargo binaries, mainly for speeding up `install-mdbook-processors`. | |
- id: cache-cargo-binaries | |
name: Cache Cargo binaries | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
~/.cargo/.crates.toml | |
~/.cargo/.crates2.json | |
key: ${{ runner.os }}-cargo-binaries-${{ hashFiles('.crates.toml.hash', '.crates2.json.hash') }} | |
restore-keys: ${{ runner.os }}-cargo-binaries- | |
- id: install-mdbook-preprocessors | |
name: Install mdBook preprocessors | |
run: cargo binstall --no-confirm --no-symlinks mdbook-admonish mdbook-external-links | |
- id: install-mdbook-diff2html-preprocessor | |
name: Install mdbook-diff2html preprocessors | |
run: cargo install --path mdbook-diff2html | |
- id: build | |
name: Build | |
run: mdbook build | |
- id: publish | |
name: Publish to GitHub pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./book |