|
1 |
| -# This is a basic workflow to help you get started with Actions |
| 1 | +name: "Deploy to GitHub Pages" |
2 | 2 |
|
3 |
| -name: CI |
4 |
| - |
5 |
| -# Controls when the action will run. Triggers the workflow on push or pull request |
6 |
| -# events but only for the master branch |
7 | 3 | on:
|
8 | 4 | push:
|
9 |
| - branches: [ master ] |
10 |
| - |
11 |
| - |
| 5 | + branches: [master] |
12 | 6 |
|
| 7 | +env: |
| 8 | + # Use fixed versions for now, replace with 'latest' to auto-use latest |
| 9 | + # Note: during build, there's a warning when using mdbook-toc compiled against an older mdbook version, should work though. |
| 10 | + MDBOOK_VERSION: "0.4.14" |
| 11 | + MDBOOK_TOC_VERSION: "0.7.0" |
| 12 | + MDBOOK_BIN: "/tmp/mdbook-bin" |
13 | 13 |
|
14 |
| - |
15 |
| - |
16 |
| -# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
17 | 14 | jobs:
|
18 |
| - # This workflow contains a single job called "build" |
19 |
| - build: |
20 |
| - # The type of runner that the job will run on |
| 15 | + build_and_deploy: |
21 | 16 | runs-on: ubuntu-latest
|
22 | 17 |
|
23 |
| - # Steps represent a sequence of tasks that will be executed as part of the job |
24 | 18 | steps:
|
25 |
| - - name: Checkout 🛎️ |
26 |
| - uses: actions/checkout@v2 # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly. |
| 19 | + # If using actions/checkout@v2, persist-credentials must be set to false in most cases for the deployment to work correctly. |
| 20 | + - name: "Checkout" |
| 21 | + uses: actions/checkout@v2 |
27 | 22 | with:
|
28 | 23 | persist-credentials: false
|
29 | 24 |
|
30 |
| - - name: Build book |
| 25 | + # Note: actions-rs/install@v0.1 was considered, but a full 'cargo install' is unnecessarily slow and the cache mechanism is not reliable |
| 26 | + # (error "Unable to download mdbook == 0.4.14 from the tool cache: Error: Unexpected HTTP response: 403") |
| 27 | + # So, directly pull the release from GitHub |
| 28 | + - name: "Install mdbook + mdbook-toc" |
31 | 29 | run: |
|
32 |
| - wget https://github.com/rust-lang/mdBook/releases/download/v0.4.12/mdbook-v0.4.12-x86_64-unknown-linux-gnu.tar.gz -O /tmp/mdbook.tar.gz |
33 |
| - /bin/tar -xvzf /tmp/mdbook.tar.gz -C /tmp |
34 |
| - /tmp/mdbook build |
| 30 | + 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 |
| 31 | + 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 |
35 | 32 |
|
| 33 | + mkdir ${MDBOOK_BIN} |
| 34 | + echo ${MDBOOK_BIN} >> $GITHUB_PATH |
| 35 | + tar -xvzf /tmp/mdbook.tar.gz -C ${MDBOOK_BIN} |
| 36 | + tar -xvzf /tmp/mdbook-toc.tar.gz -C ${MDBOOK_BIN} |
| 37 | +
|
| 38 | + - name: "Build book" |
| 39 | + run: mdbook build |
36 | 40 |
|
37 |
| - - name: Deploy 🚀 |
| 41 | + - name: "Deploy" |
38 | 42 | uses: JamesIves/github-pages-deploy-action@releases/v3
|
39 | 43 | with:
|
40 | 44 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
0 commit comments