diff --git a/.github/workflows/mdbook.yml b/.github/workflows/mdbook.yml new file mode 100644 index 0000000..d10c1b8 --- /dev/null +++ b/.github/workflows/mdbook.yml @@ -0,0 +1,43 @@ +# Build the AVR-Rust mdBook site and deploy to GitHub Pages +name: Deploy mdBook site to Pages + +concurrency: + group: "pages" + cancel-in-progress: false +jobs: + build: + runs-on: ubuntu-latest + 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 mdbook + - name: Setup Pages + id: pages + uses: actions/configure-pages@v4 + - name: Build site using mdBook + run: mdbook build + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./book + 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 +on: + push: + branches: ["master"] + workflow_dispatch: +permissions: + contents: read + pages: write + id-token: write 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/README.md b/README.md index f7f3745..37f4f84 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`. 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}'"