|
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 |
6 | 2 |
|
7 | 3 | on:
|
8 |
| - # Runs on pushes targeting the default branch |
9 |
| - push: |
10 |
| - branches: ["main"] |
| 4 | + pull_request: |
11 | 5 |
|
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 |
| 6 | +env: |
| 7 | + MDBOOK_VERSION: 0.4.21 |
| 8 | + MDBOOK_ALERTS_VERSION: 0.6.7 |
| 9 | + MDBOOK_LINKCHECK_VERSION: 0.7.7 |
26 | 10 |
|
27 | 11 | jobs:
|
28 |
| - # Build job |
29 | 12 | build:
|
30 | 13 | runs-on: ubuntu-latest
|
31 |
| - env: |
32 |
| - MDBOOK_VERSION: 0.4.21 |
33 |
| - MDBOOK_ALERTS_VERSION: 0.6.7 |
34 |
| - MDBOOK_LINKCHECK_VERSION: 0.7.7 |
35 |
| - PUBLISH_DOMAIN: component-model.bytecodealliance.org |
36 | 14 | steps:
|
37 | 15 | - uses: actions/checkout@v3
|
38 |
| - - name: Install mdBook |
39 |
| - run: | |
40 |
| - curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh |
41 |
| - rustup update |
42 |
| - cargo install --version ${MDBOOK_VERSION} mdbook |
43 |
| - cargo install --version ${MDBOOK_ALERTS_VERSION} mdbook-alerts |
44 |
| - cargo install --version ${MDBOOK_LINKCHECK_VERSION} mdbook-linkcheck |
45 |
| - - name: Setup Pages |
46 |
| - id: pages |
47 |
| - uses: actions/configure-pages@v3 |
48 |
| - - name: Build with mdBook |
49 |
| - run: mdbook build component-model |
50 |
| - - name: Setup Python |
51 |
| - uses: actions/setup-python@v5 |
| 16 | + |
| 17 | + - uses: taiki-e/cache-cargo-install-action@v2 |
| 18 | + with: |
| 19 | + tool: mdbook@${{ env.MDBOOK_VERSION }} |
| 20 | + |
| 21 | + - uses: taiki-e/cache-cargo-install-action@v2 |
52 | 22 | with:
|
53 |
| - python-version: '3.13' |
54 |
| - - name: Generate sitemap |
55 |
| - run: | |
56 |
| - cd component-model |
57 |
| - python3 ../scripts/generate_sitemap.py --domain "component-model.bytecodealliance.org" --higher-priority "design" --output-path book/sitemap.xml |
58 |
| - cd .. |
59 |
| - - name: Upload artifact |
60 |
| - uses: actions/upload-pages-artifact@v3 |
| 23 | + tool: mdbook-alerts@${{ env.MDBOOK_ALERTS_VERSION }} |
| 24 | + |
| 25 | + - uses: taiki-e/cache-cargo-install-action@v2 |
61 | 26 | with:
|
62 |
| - path: ./component-model/book |
| 27 | + tool: mdbook-linkcheck@${{ env.MDBOOK_LINKCHECK_VERSION }} |
63 | 28 |
|
64 |
| - # Deployment job |
65 |
| - deploy: |
66 |
| - if: ${{ github.repository_owner == 'bytecodealliance' }} |
67 |
| - environment: |
68 |
| - name: github-pages |
69 |
| - url: ${{ steps.deployment.outputs.page_url }} |
70 |
| - runs-on: ubuntu-latest |
71 |
| - needs: build |
72 |
| - steps: |
73 |
| - - name: Deploy to GitHub Pages |
74 |
| - id: deployment |
75 |
| - uses: actions/deploy-pages@v4 |
| 29 | + - name: Build with mdBook |
| 30 | + run: mdbook build component-model |
0 commit comments