Skip to content

build: Cache builds #243

build: Cache builds

build: Cache builds #243

Workflow file for this run

name: Deploy
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
component: clippy
- name: Cache Cargo registry and build
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install specific version of mdbook and mdbook-hints
run: |
cargo install [email protected]
cargo install [email protected]
- name: Build the book
run: mdbook build
- name: Deploy GitHub Pages
run: |
git worktree add gh-pages
git config user.name "Deploy from CI"
git config user.email ""
cd gh-pages
git update-ref -d refs/heads/gh-pages
rm -rf *
mv ../book/* .
git add .
git commit -m "Deploy $GITHUB_SHA to gh-pages"
git push --force --set-upstream origin gh-pages