Docs build #282
Workflow file for this run
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: Docs build | |
on: | |
push: | |
branches-ignore: | |
- "dependabot/**" | |
tags: | |
- "*" | |
jobs: | |
build: | |
name: "Documentation build" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v2 | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: default | |
default: true | |
- name: Install mdbook | |
run: wget -O - https://github.com/rust-lang/mdBook/releases/download/v0.4.21/mdbook-v0.4.21-x86_64-unknown-linux-gnu.tar.gz | tar xz | |
- name: Install mdbook-mermaid | |
run: wget -O - https://github.com/badboy/mdbook-mermaid/releases/download/v0.12.6/mdbook-mermaid-v0.12.6-x86_64-unknown-linux-gnu.tar.gz | tar xz | |
- name: Build documentation without private items | |
run: cargo doc && mv target/doc ..staging | |
- name: Build documentation with private items | |
run: cargo doc --document-private-items --all --all-features --no-deps && mv target/doc ..staging/private | |
- name: Setup mermaid preprocessor | |
run: ./mdbook-mermaid install book | |
- name: Build book | |
run: ./mdbook build -d $PWD/..staging/book book | |
- name: Clone site repo | |
uses: actions/checkout@v2 | |
with: | |
ssh-key: ${{secrets.API_KEY}} | |
path: ..site-repo | |
ref: gh-pages | |
- name: Delete previous build | |
run: test ! -d ${{github.ref_name}} || rm -r ${{github.ref_name}} | |
working-directory: ..site-repo | |
- name: Copy artifact to site repo | |
run: (test -d $(dirname ..site-repo/${{github.ref_name}}) || mkdir -p $(dirname ..site-repo/${{github.ref_name}})) && cp -r ..staging ..site-repo/${{github.ref_name}} | |
- name: Set Git author | |
run: git config --global user.name "github-actions[bot]" && git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
- name: Git commit | |
run: git add ${{github.ref_name}} && git commit --allow-empty -m "Docs build for SOF3/dynec@${{github.sha}}" | |
working-directory: ..site-repo | |
- name: Push pages | |
run: while ! git push; do git pull --rebase --no-edit || exit 1; done | |
working-directory: ..site-repo |