Add mdbook
and refactor README.md
#2
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 mdbook | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build-book: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: "Checkout repository" | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: "Install mdbook" | |
run: | | |
mkdir bin | |
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdbook-v0.4.40-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin | |
- name: "Build book" | |
run: bin/mdbook build | |
- name: "Upload artifact" | |
uses: actions/upload-pages-artifact@0252fc4ba7626f0298f0cf00902a25c6afc77fa8 # v3.0.0 | |
with: | |
path: ./target/book | |
book-deploy: | |
needs: build-book | |
if: github.ref == 'refs/heads/main' | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Deploy docs to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@87c3283f01cd6fe19a0ab93a23b2f6fcba5a8e42 # v4.0.3 |