From 89b56fbd7140ddf13b01b62f593e35ee427d77ed Mon Sep 17 00:00:00 2001 From: John Adler Date: Sat, 29 May 2021 15:27:56 -0400 Subject: [PATCH] Add CI action to deploy book to GitHub pages. (#167) --- .github/workflows/gh-pages.yml | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/gh-pages.yml diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml new file mode 100644 index 00000000..8c07d5c3 --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -0,0 +1,43 @@ +name: github pages + +on: + push: + branches: + - master + tags: + - v* + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Setup mdBook + uses: peaceiris/actions-mdbook@v1 + with: + mdbook-version: '0.4.8' + + - run: mdbook build docs + + - name: Deploy latest + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs/book + destination_dir: latest + if: github.ref == 'refs/heads/master' + + - name: Get tag + id: branch_name + run: | + echo ::set-output name=BRANCH_NAME::${GITHUB_REF#refs/tags/} + if: startsWith(github.ref, 'refs/tags') + + - name: Deploy tag + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs/book + destination_dir: ${{ steps.branch_name.outputs.BRANCH_NAME }} + if: startsWith(github.ref, 'refs/tags')