1- # Sample workflow for building and deploying a mdBook site to GitHub Pages
2- #
3- # To get started with mdBook see: https://rust-lang.github.io/mdBook/index.html
4- #
5- name : Deploy mdBook site to Pages
1+ name : mdbook
62
73on :
8- # Runs on pushes targeting the default branch
9- push :
10- branches : ["main"]
11-
12- # Allows you to run this workflow manually from the Actions tab
13- workflow_dispatch :
14-
15- # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16- permissions :
17- contents : read
18- pages : write
19- id-token : write
20-
21- # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
22- # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
23- concurrency :
24- group : " pages"
25- cancel-in-progress : false
4+ pull_request :
265
276env :
287 MDBOOK_VERSION : 0.4.21
298 MDBOOK_ALERTS_VERSION : 0.6.7
309 MDBOOK_LINKCHECK_VERSION : 0.7.7
31- PUBLISH_DOMAIN : component-model.bytecodealliance.org
32- ARTIFACT_PATH : ./component-model/book/html
3310
3411jobs :
3512 build :
3613 runs-on : ubuntu-latest
3714 steps :
3815 - uses : actions/checkout@v3
39- - name : Install mdBook
40- run : |
41- curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh
42- rustup update
43- cargo install --version ${{ env.MDBOOK_VERSION }} mdbook
44- cargo install --version ${{ env.MDBOOK_ALERTS_VERSION }} mdbook-alerts
45- cargo install --version ${{ env.MDBOOK_LINKCHECK_VERSION }} mdbook-linkcheck
4616
47- - name : Build with mdBook
48- run : mdbook build component-model
17+ - uses : taiki-e/cache-cargo-install-action@v2
18+ with :
19+ tool : mdbook@${{ env.MDBOOK_VERSION }}
4920
50- - name : Setup Python
51- uses : actions/setup-python@v5
21+ - uses : taiki-e/cache-cargo-install-action@v2
5222 with :
53- python-version : ' 3.13'
23+ tool : mdbook-alerts@${{ env.MDBOOK_ALERTS_VERSION }}
24+
25+ - uses : taiki-e/cache-cargo-install-action@v2
26+ with :
27+ tool : mdbook-linkcheck@${{ env.MDBOOK_LINKCHECK_VERSION }}
28+
29+ - name : Build with mdBook
30+ run : mdbook build component-model
5431
55- # Ensure the build generated properly
5632 - name : Ensure build outputs are present
5733 shell : bash
5834 run : |
@@ -61,31 +37,14 @@ jobs:
6137 exit 1;
6238 fi
6339
40+ - name : Setup Python
41+ uses : actions/setup-python@v5
42+ with :
43+ python-version : ' 3.13'
44+
6445 - name : Generate sitemap
6546 shell : bash
6647 run : |
6748 cd ${{ env.ARTIFACT_PATH }}
6849 python3 ../../../scripts/generate_sitemap.py --domain "component-model.bytecodealliance.org" --higher-priority "design" --output-path sitemap.xml
6950 cd ../../../
70-
71- - name : Setup Pages
72- id : pages
73- uses : actions/configure-pages@v3
74-
75- - name : Upload artifact
76- uses : actions/upload-pages-artifact@v3
77- with :
78- path : ${{ env.ARTIFACT_PATH }}
79-
80- # Deployment job
81- deploy :
82- if : ${{ github.repository_owner == 'bytecodealliance' }}
83- environment :
84- name : github-pages
85- url : ${{ steps.deployment.outputs.page_url }}
86- runs-on : ubuntu-latest
87- needs : build
88- steps :
89- - name : Deploy to GitHub Pages
90- id : deployment
91- uses : actions/deploy-pages@v4
0 commit comments