Build docs #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 docs | |
on: | |
push: | |
branches: | |
- main | |
paths: ["docs/**/*"] | |
workflow_dispatch: | |
jobs: | |
deploy: | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
# Deploy to the github-pages environment | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- run: cargo install mdbook | |
- run: cargo install mdbook-mermaid | |
- run: mdbook build | |
working-directory: ./docs | |
- name: Archive artifact | |
shell: sh | |
working-directory: ./docs/book | |
run: | | |
tar \ | |
--dereference --hard-dereference \ | |
-cvf "$RUNNER_TEMP/artifact.tar" \ | |
--exclude=.git \ | |
--exclude=.github \ | |
. | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "github-pages" | |
path: ${{ runner.temp }}/artifact.tar | |
retention-days: 1 | |
if-no-files-found: error | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |