ReadMe #52
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: "Deploy to GitHub Pages" | |
on: | |
push: | |
branches: [master] | |
env: | |
# Use fixed versions for now, replace with 'latest' to auto-use latest | |
# Note: during build, there's a warning when using mdbook-toc compiled against an older mdbook version, should work though. | |
MDBOOK_VERSION: "0.4.32" | |
MDBOOK_TOC_VERSION: "0.13.0" | |
MDBOOK_ADMONISH_VERSION: "1.10.1" | |
MDBOOK_BIN: "/tmp/mdbook-bin" | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# If using actions/checkout@v2, persist-credentials must be set to false in most cases for the deployment to work correctly. | |
- name: "Checkout" | |
uses: actions/checkout@v3 | |
# Note: actions-rs/[email protected] was considered, but a full 'cargo install' is unnecessarily slow and the cache mechanism is not reliable | |
# (error "Unable to download mdbook == 0.4.14 from the tool cache: Error: Unexpected HTTP response: 403") | |
# So, directly pull the release from GitHub | |
- name: "Install mdbook, mdbook-toc, mdbook-admonish" | |
run: | | |
wget https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz \ | |
-O /tmp/mdbook.tar.gz | |
wget https://github.com/badboy/mdbook-toc/releases/download/${MDBOOK_TOC_VERSION}/mdbook-toc-${MDBOOK_TOC_VERSION}-x86_64-unknown-linux-gnu.tar.gz \ | |
-O /tmp/mdbook-toc.tar.gz | |
wget https://github.com/tommilligan/mdbook-admonish/releases/download/v${MDBOOK_ADMONISH_VERSION}/mdbook-admonish-v${MDBOOK_ADMONISH_VERSION}-x86_64-unknown-linux-gnu.tar.gz \ | |
-O /tmp/mdbook-admonish.tar.gz | |
mkdir ${MDBOOK_BIN} | |
echo ${MDBOOK_BIN} >> $GITHUB_PATH | |
tar -xvzf /tmp/mdbook.tar.gz -C ${MDBOOK_BIN} | |
tar -xvzf /tmp/mdbook-toc.tar.gz -C ${MDBOOK_BIN} | |
tar -xvzf /tmp/mdbook-admonish.tar.gz -C ${MDBOOK_BIN} | |
- name: "Build book" | |
run: mdbook build | |
- name: "Upload Pages artifact" | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: book | |
- name: "Deploy to GitHub Pages" | |
uses: actions/deploy-pages@v2 |