Skip to content

Commit

Permalink
docs: add build cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuhvi committed Sep 8, 2024
1 parent 1adf445 commit 8005034
Showing 1 changed file with 32 additions and 8 deletions.
40 changes: 32 additions & 8 deletions .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,44 @@ jobs:
- name: Run docs
run: cargo doc --workspace --all-features --no-deps --document-private-items --verbose

- name: Install mdBook and mdBook-Mermaid


- name: Cache mdbook installation
uses: actions/cache@v2
with:
path: ~/.cargo/bin/mdbook
key: ${{ runner.os }}-mdbook

- name: Cache mdbook-mermaid installation
uses: actions/cache@v2
with:
path: ~/.cargo/bin/mdbook
key: ${{ runner.os }}-mdbook-mermaid

- name: Install mdBook if not installed already
run: |
cargo install mdbook
cargo install mdbook-mermaid
mdbook-mermaid install ./docs/
if [ ! -f ~/.cargo/bin/mdbook ]; then
cargo install mdbook
fi
- name: Install mdBook-mermaid if not installed already
run: |
if [ ! -f ~/.cargo/bin/mdbook-mermaid ]; then
cargo install mdbook-mermaid
fi
- name: Cache mdBook build
id: cache-mdbook
id: mdbook-build-cache
uses: actions/cache@v3
with:
path: path/to/your/book/book-output
key: ${{ runner.os }}-mdbook-${{ hashFiles('path/to/your/book/**') }}
path: ./docs/book/
key: ${{ runner.os }}-mdbook-${{ hashFiles('./docs/**') }}
restore-keys: |
${{ runner.os }}-mdbook-
- name: Build the book
run: mdbook build /docs/
run: mdbook build ./docs/

- name: Build the book
if: steps.mdbook-build-cache.outputs.cache-hit != 'true'
run: mdbook build ./docs/

0 comments on commit 8005034

Please sign in to comment.