From 68c629c158436f6d5a6bd0bcfe138a656a0a1e91 Mon Sep 17 00:00:00 2001 From: John Eckersberg Date: Wed, 15 May 2024 12:08:41 -0400 Subject: [PATCH] ci/docs: Add mdbook-linkcheck Fixes #521 Signed-off-by: John Eckersberg --- .github/workflows/ci.yml | 31 +++++++++++++++++++++++++++++++ .github/workflows/docs.yml | 10 +++++++++- docs/book.toml | 2 ++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f25aa332a..1a04ff0e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -199,3 +199,34 @@ jobs: truncate -s 20G ${tmpdisk} sudo podman run --rm --privileged --env RUST_LOG=debug -v /dev:/dev -v /:/target -v /var/lib/containers:/var/lib/containers -v ./usr/bin/bootc:/usr/bin/bootc --pid=host --security-opt label=disable \ -v ${tmpdisk}:/disk ${image} bootc install to-disk --via-loopback /disk + docs: + if: ${{ contains(github.event.pull_request.labels.*.name, 'documentation') }} + runs-on: ubuntu-latest + env: + MDBOOK_VERSION: 0.4.37 + steps: + - uses: actions/checkout@v4 + - name: Install mdBook + run: | + tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name') + url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz" + mkdir mdbook + curl -sSL $url | tar -xz --directory=./mdbook + echo `pwd`/mdbook >> $GITHUB_PATH + - name: Install mdbook-mermaid + run: | + tag=$(curl 'https://api.github.com/repos/badboy/mdbook-mermaid/releases/latest' | jq -r '.tag_name') + url="https://github.com/badboy/mdbook-mermaid/releases/download/${tag}/mdbook-mermaid-${tag}-x86_64-unknown-linux-gnu.tar.gz" + mkdir mdbook-mermaid + curl -sSL $url | tar -xz --directory=./mdbook-mermaid + echo `pwd`/mdbook-mermaid >> $GITHUB_PATH + - name: Install mdbook-linkcheck + run: | + tag=$(curl 'https://api.github.com/repos/Michael-F-Bryan/mdbook-linkcheck/releases/latest' | jq -r '.tag_name') + archive="mdbook-linkcheck.x86_64-unknown-linux-gnu.zip" + url="https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/${tag}/${archive}" + mkdir mdbook-linkcheck + curl -sSL -O $url && unzip ${archive} -d ./mdbook-linkcheck && chmod +x ./mdbook-linkcheck/mdbook-linkcheck + echo `pwd`/mdbook-linkcheck >> $GITHUB_PATH + - name: Build with mdBook + run: cd docs && mdbook-mermaid install && mdbook build diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 868834377..816a3dd67 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -35,6 +35,14 @@ jobs: mkdir mdbook-mermaid curl -sSL $url | tar -xz --directory=./mdbook-mermaid echo `pwd`/mdbook-mermaid >> $GITHUB_PATH + - name: Install mdbook-linkcheck + run: | + tag=$(curl 'https://api.github.com/repos/Michael-F-Bryan/mdbook-linkcheck/releases/latest' | jq -r '.tag_name') + archive="mdbook-linkcheck.x86_64-unknown-linux-gnu.zip" + url="https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/${tag}/${archive}" + mkdir mdbook-linkcheck + curl -sSL -O $url && unzip ${archive} -d ./mdbook-linkcheck && chmod +x ./mdbook-linkcheck/mdbook-linkcheck + echo `pwd`/mdbook-linkcheck >> $GITHUB_PATH - name: Setup Pages id: pages uses: actions/configure-pages@v4 @@ -43,7 +51,7 @@ jobs: - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: - path: ./docs/book + path: ./docs/book/html deploy: environment: diff --git a/docs/book.toml b/docs/book.toml index 105809ff5..fa4ba8f4e 100644 --- a/docs/book.toml +++ b/docs/book.toml @@ -10,3 +10,5 @@ command = "mdbook-mermaid" [output.html] additional-js = ["mermaid.min.js", "mermaid-init.js"] + +[output.linkcheck]