Created using Colab #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: Build book and deploy GitHub Pages | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Cache Rust binaries | |
id: cache-rust | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cargo/bin/* | |
# This key must be changed every time a new Rust binary is added. | |
key: ${{runner.os}}-rust | |
- name: Install mdbook | |
if: steps.cache-rust.outputs.cache-hit != 'true' | |
run: | | |
curl -LSfs https://japaric.github.io/trust/install.sh | \ | |
sh -s -- --git rust-lang/mdBook | |
- name: Install mdbook-linkcheck | |
if: steps.cache-rust.outputs.cache-hit != 'true' | |
run: | | |
curl -LSfs https://japaric.github.io/trust/install.sh | \ | |
sh -s -- --git Michael-F-Bryan/mdbook-linkcheck --tag v0.7.0 | |
- name: Install mdbook-regex-replacer | |
if: steps.cache-rust.outputs.cache-hit != 'true' | |
uses: actions-rs/[email protected] | |
with: | |
crate: mdbook-regex-replacer | |
version: latest | |
use-tool-cache: true | |
- name: Build book | |
run: | | |
~/.cargo/bin/mdbook build ./ | |
- name: Commit changes to gh-pages | |
run: | | |
rm -f .gitignore | |
git config user.email "[email protected]" | |
git config user.name "GitHub Actions" | |
git checkout -b tmp/gh-pages | |
git add -A | |
git commit -m "Update GitHub pages" | |
git push origin tmp/gh-pages:gh-pages --force |