From 3d354adee527d0ea33244897793b704dc351f1a3 Mon Sep 17 00:00:00 2001 From: jokust Date: Wed, 20 Mar 2024 12:20:40 -0700 Subject: [PATCH 1/5] Create mdbook.yml --- .github/workflows/mdbook.yml | 60 ++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/mdbook.yml diff --git a/.github/workflows/mdbook.yml b/.github/workflows/mdbook.yml new file mode 100644 index 0000000..5a6ce0f --- /dev/null +++ b/.github/workflows/mdbook.yml @@ -0,0 +1,60 @@ +# Sample workflow for building and deploying a mdBook site to GitHub Pages +# +# To get started with mdBook see: https://rust-lang.github.io/mdBook/index.html +# +name: Deploy mdBook site to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ["master"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Build job + build: + runs-on: ubuntu-latest + env: + MDBOOK_VERSION: 0.4.36 + steps: + - uses: actions/checkout@v4 + - name: Install mdBook + run: | + curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh + rustup update + cargo install --version ${MDBOOK_VERSION} mdbook + - name: Setup Pages + id: pages + uses: actions/configure-pages@v4 + - name: Build with mdBook + run: mdbook build + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./book + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 From 008256a9aeb7a8908331622958f349b26e9965c2 Mon Sep 17 00:00:00 2001 From: Spencer Thomas Date: Wed, 20 Mar 2024 12:22:52 -0700 Subject: [PATCH 2/5] remove existing publish methods --- .github/workflows/publish.yml | 34 ----------------------------- update-github-pages.sh | 41 ----------------------------------- 2 files changed, 75 deletions(-) delete mode 100644 .github/workflows/publish.yml delete mode 100755 update-github-pages.sh diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 0d76a9c..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Build and Deploy -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - build-and-deploy: - runs-on: ubuntu-latest - steps: - - name: Checkout - # If you're using actions/checkout@v2 you must set - # persist-credentials to false in most cases for the - # deployment to work correctly. - uses: actions/checkout@v2 - with: - persist-credentials: false - - - name: Install and Build - run: | - wget 'https://github.com/rust-lang/mdBook/releases/download/v0.4.1/mdbook-v0.4.1-x86_64-unknown-linux-gnu.tar.gz' - tar -xf mdbook-v0.4.1-x86_64-unknown-linux-gnu.tar.gz - ./mdbook build -d "${GITHUB_WORKSPACE}/build" "${GITHUB_WORKSPACE}" - - - name: Deploy - uses: JamesIves/github-pages-deploy-action@3.7.1 - if: github.event_name == 'push' - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BRANCH: gh-pages - FOLDER: build diff --git a/update-github-pages.sh b/update-github-pages.sh deleted file mode 100755 index 777d5c8..0000000 --- a/update-github-pages.sh +++ /dev/null @@ -1,41 +0,0 @@ -#! /bin/sh -ea - -# This script can be used to export the book to HTML format and push the -# artifacts to the GitHub 'gh-pages' branch. - -BOOK_DIR=$(dirname $0) -TARGET_BRANCH=gh-pages - -function note() { - echo "[note]: $@" -} - -cd "${BOOK_DIR}" - -repository_url=$(git remote get-url origin) -staging_dir=$(mktemp -qd) - -note "created staging directory at '$staging_dir'" - - -note "generating book " -mdbook build -d "${staging_dir}" "${BOOK_DIR}" - -cd "${staging_dir}" -git init - -git add . -git commit -m "Generate the HTML version of the book" -git branch -m $TARGET_BRANCH - -echo "book.avr-rust.com" > CNAME -git add CNAME -git commit -m "Add CNAME configuring the book.avr-rust.com custom domain" - -git remote add origin "${repository_url}" - -note "pushing the '$TARGET_BRANCH' branch to '${repository_url}'" - -git push origin $TARGET_BRANCH --force - -note "staging directory left at '${staging_dir}'" From 1d1e93cb3a81ef6a819405e4c135ffc0639b17e3 Mon Sep 17 00:00:00 2001 From: Spencer Thomas Date: Wed, 20 Mar 2024 12:48:41 -0700 Subject: [PATCH 3/5] change README .com references to .org and tidy usage documentation --- README.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f7f3745..4750013 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,19 @@ A guidebook for AVR-Rust development. -Hosted on [book.avr-rust.com/](https://book.avr-rust.com/). +Hosted on [book.avr-rust.org/](https://book.avr-rust.org/). -## Building the book +## Build dependencies -Install `mdbook`. Yes, you can get it through `cargo install`. +Install `mdbook`: -Then run `mdbook build`. +If rust and cargo are installed, you can build mdbook from source and install using `cargo install mdbook`. + +mdbook's documentation also details [all mdbook installation methods](https://rust-lang.github.io/mdBook/guide/installation.html). + +## Building the AVR documentation book + +Run `mdbook build`. + +By default the book is output to the `book` directory and the HTML index is output to `book/index.html`. From 9cea3c856fe11f723a532e13e4f9abcd7646143a Mon Sep 17 00:00:00 2001 From: Spencer Thomas Date: Wed, 20 Mar 2024 13:04:33 -0700 Subject: [PATCH 4/5] tidy mdbook publish workflow from template default --- .github/workflows/mdbook.yml | 39 ++++++++++-------------------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/.github/workflows/mdbook.yml b/.github/workflows/mdbook.yml index 5a6ce0f..d10c1b8 100644 --- a/.github/workflows/mdbook.yml +++ b/.github/workflows/mdbook.yml @@ -1,53 +1,28 @@ -# Sample workflow for building and deploying a mdBook site to GitHub Pages -# -# To get started with mdBook see: https://rust-lang.github.io/mdBook/index.html -# +# Build the AVR-Rust mdBook site and deploy to GitHub Pages name: Deploy mdBook site to Pages -on: - # Runs on pushes targeting the default branch - push: - branches: ["master"] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. concurrency: group: "pages" cancel-in-progress: false - jobs: - # Build job build: runs-on: ubuntu-latest - env: - MDBOOK_VERSION: 0.4.36 steps: - uses: actions/checkout@v4 - name: Install mdBook run: | curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh rustup update - cargo install --version ${MDBOOK_VERSION} mdbook + cargo install mdbook - name: Setup Pages id: pages uses: actions/configure-pages@v4 - - name: Build with mdBook + - name: Build site using mdBook run: mdbook build - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: path: ./book - - # Deployment job deploy: environment: name: github-pages @@ -58,3 +33,11 @@ jobs: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 +on: + push: + branches: ["master"] + workflow_dispatch: +permissions: + contents: read + pages: write + id-token: write From d1fd75d24b92b68b5e11877040309d81482484b6 Mon Sep 17 00:00:00 2001 From: Spencer Thomas Date: Wed, 20 Mar 2024 13:15:05 -0700 Subject: [PATCH 5/5] correct mdBook capitalization --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4750013..37f4f84 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,11 @@ Hosted on [book.avr-rust.org/](https://book.avr-rust.org/). ## Build dependencies -Install `mdbook`: +Install mdBook: -If rust and cargo are installed, you can build mdbook from source and install using `cargo install mdbook`. +If rust and cargo are installed, you can build mdBook from source and install using `cargo install mdbook`. -mdbook's documentation also details [all mdbook installation methods](https://rust-lang.github.io/mdBook/guide/installation.html). +mdBook's documentation also details [all mdBook installation methods](https://rust-lang.github.io/mdBook/guide/installation.html). ## Building the AVR documentation book