16 concurrency: |
16 concurrency: |
17 group: "pages" |
17 group: "pages" |
18 cancel-in-progress: true |
18 cancel-in-progress: true |
19 |
19 |
20 jobs: |
20 jobs: |
|
21 # Build and deploy the documentation of master and the stable/v0.5 branch |
21 deploy: |
22 deploy: |
22 runs-on: ubuntu-latest |
23 runs-on: ubuntu-latest |
23 environment: |
24 environment: |
24 name: github-pages |
25 name: github-pages |
25 url: ${{ steps.deployment.outputs.page_url }} |
26 url: ${{ steps.deployment.outputs.page_url }} |
26 steps: |
27 steps: |
27 - uses: actions/checkout@v4 |
|
28 - name: Setup Pages |
|
29 uses: actions/configure-pages@v3 |
|
30 - name: Install mdbook |
28 - name: Install mdbook |
31 env: |
29 env: |
32 MDBOOK_VERSION: 'v0.4.27' |
30 MDBOOK_VERSION: 'v0.4.27' |
33 run: | |
31 run: | |
34 mkdir mdbook |
32 mkdir mdbook |
35 curl -sSL https://github.com/rust-lang/mdBook/releases/download/${MDBOOK_VERSION}/mdbook-${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook |
33 curl -sSL https://github.com/rust-lang/mdBook/releases/download/${MDBOOK_VERSION}/mdbook-${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook |
36 echo `pwd`/mdbook >> $GITHUB_PATH |
34 echo `pwd`/mdbook >> $GITHUB_PATH |
37 - name: Build mdbook |
35 - name: Checkout master |
38 run: | |
36 uses: actions/checkout@v4 |
39 cd doc |
37 with: |
40 mdbook build |
38 path: main |
|
39 - name: Checkout stable/v0.5 |
|
40 uses: actions/checkout@v4 |
|
41 with: |
|
42 path: stable-v0.5 |
|
43 ref: 'stable/v0.5' |
|
44 - name: Setup Pages |
|
45 uses: actions/configure-pages@v3 |
|
46 - name: Build mdbook for main branch |
|
47 working-directory: 'main/doc' |
|
48 run: mdbook build |
|
49 - name: Build mdbook for stable/v0.5 branch |
|
50 working-directory: 'stable-v0.5/doc' |
|
51 run: mdbook build |
41 # Override mdbooks default highlight.js with a custom version containing CMake support. |
52 # Override mdbooks default highlight.js with a custom version containing CMake support. |
42 - uses: actions/checkout@v4 |
53 - uses: actions/checkout@v4 |
43 with: |
54 with: |
44 repository: 'highlightjs/highlight.js' |
55 repository: 'highlightjs/highlight.js' |
45 # mdbook currently (as of v0.4.27) does not support v11 yet. |
56 # mdbook currently (as of v0.4.27) does not support v11 yet. |
50 npm install |
61 npm install |
51 node tools/build.js :common cmake yaml |
62 node tools/build.js :common cmake yaml |
52 working-directory: highlightjs |
63 working-directory: highlightjs |
53 - name: Override highlightjs |
64 - name: Override highlightjs |
54 run: | |
65 run: | |
55 cp highlightjs/build/highlight.min.js doc/book/highlight.js |
66 cp highlightjs/build/highlight.min.js main/doc/book/highlight.js |
|
67 cp highlightjs/build/highlight.min.js stable-v0.5/doc/book/highlight.js |
|
68 - name: Copy stable doc into main |
|
69 run: mkdir main/doc/book/v0.5 && cp -a stable-v0.5/doc/book/. main/doc/book/v0.5/ |
|
70 - name: Debug print |
|
71 run: ls -la main/doc/book/v0.5 |
56 - name: Upload artifact |
72 - name: Upload artifact |
57 uses: actions/upload-pages-artifact@v1 |
73 uses: actions/upload-pages-artifact@v2 |
58 with: |
74 with: |
59 path: 'doc/book' |
75 path: 'main/doc/book' |
60 - name: Deploy to GitHub Pages |
76 - name: Deploy to GitHub Pages |
61 id: deployment |
77 id: deployment |
62 uses: actions/deploy-pages@v1 |
78 uses: actions/deploy-pages@v2 |