From 032c978b1380ecd8390db67eef993ee292071d52 Mon Sep 17 00:00:00 2001 From: kraktus Date: Fri, 10 Nov 2023 14:40:35 +0100 Subject: [PATCH 1/2] include criterion repo link in book To allow for easy redirection to the repo from the book --- book/book.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/book/book.toml b/book/book.toml index c9d3fcc65..aba42c3b3 100644 --- a/book/book.toml +++ b/book/book.toml @@ -4,6 +4,7 @@ description = "User Guide and Other Prose Documentation For Criterion.rs" author = "Brook Heisler" [output.html] +git-repository-url = "https://github.com/bheisler/criterion.rs" [output.linkcheck] #follow-web-links = true From d71f0908c82f44292d6c5a3a2f49b2ce378fa572 Mon Sep 17 00:00:00 2001 From: kraktus Date: Fri, 10 Nov 2023 13:35:55 +0100 Subject: [PATCH 2/2] Book: CD to Github page Needs to select "Github action" here: https://github.com/kraktus/criterion.rs/settings/pages I based myself on mdbook CD wiki: https://github.com/rust-lang/mdBook/wiki/Automated-Deployment:-GitHub-Actions This action will deploy the book whenever the master branch is updated. This can lead to slight differences between the book and the crate, if the book is updated before new crate version is released, but on the other will allow fixing typos and other issues easily. --- .github/workflows/book.yaml | 62 +++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/book.yaml diff --git a/.github/workflows/book.yaml b/.github/workflows/book.yaml new file mode 100644 index 000000000..f0c679530 --- /dev/null +++ b/.github/workflows/book.yaml @@ -0,0 +1,62 @@ +on: + push: + branches: + - master + paths: + - 'book/**' + - ".github/workflows/book.yaml" + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: 'pages' + cancel-in-progress: true + +name: book +env: + CARGO_TERM_COLOR: always + + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install latest 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 latest linkcheck + # Adapted from https://github.com/Michael-F-Bryan/mdbook-linkcheck README + run: | + mkdir -p mdbook-linkcheck && \ + curl -L https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/latest/download/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip -o mdbook-linkcheck/mdbook-linkcheck.zip && \ + unzip -d ./mdbook-linkcheck mdbook-linkcheck/mdbook-linkcheck.zip && \ + chmod +x mdbook-linkcheck/mdbook-linkcheck && \ + echo `pwd`/mdbook-linkcheck >> $GITHUB_PATH + - name: Build Book + run: | + cd book && mdbook build + - name: Setup Pages + uses: actions/configure-pages@v2 + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + with: + # Upload entire repository + path: 'book/book/html' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 \ No newline at end of file