|
1 | 1 | name: Build and deploy an updated version of the website |
2 | 2 |
|
3 | | -on: |
4 | | - [push, pull_request] |
| 3 | +on: [push, pull_request] |
5 | 4 |
|
6 | 5 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
7 | 6 | permissions: |
8 | 7 | contents: read |
9 | 8 | pages: write |
10 | 9 | id-token: write |
11 | | - |
| 10 | + |
12 | 11 | env: |
13 | | - MDBOOK_LINKCHECK_VER: 0.7.4 |
| 12 | + MDBOOK_LINKCHECK_VER: 0.7.7 |
14 | 13 |
|
15 | 14 | jobs: |
16 | 15 | build: |
17 | 16 | runs-on: ubuntu-latest |
18 | 17 | steps: |
19 | | - - name: Checkout gb-asm-tutorial |
20 | | - uses: actions/checkout@v2 |
21 | | - with: |
22 | | - path: gb-asm-tutorial |
| 18 | + - name: Checkout gb-asm-tutorial |
| 19 | + uses: actions/checkout@v2 |
| 20 | + with: |
| 21 | + path: gb-asm-tutorial |
| 22 | + |
| 23 | + - name: Install mdbook |
| 24 | + uses: peaceiris/actions-mdbook@v1 |
| 25 | + with: |
| 26 | + mdbook-version: latest |
| 27 | + |
| 28 | + - name: Install static-sitemap-cli |
| 29 | + run: npm install static-sitemap-cli |
23 | 30 |
|
24 | | - - name: Install mdbook |
25 | | - uses: peaceiris/actions-mdbook@v1 |
26 | | - with: |
27 | | - mdbook-version: latest |
28 | | - |
29 | | - - name: Install static-sitemap-cli |
30 | | - run: npm install static-sitemap-cli |
| 31 | + # FIXME: Keep this up to date |
| 32 | + - name: Install mdbook-linkcheck |
| 33 | + run: | # `-L` because GitHub performs a redirection |
| 34 | + curl -L -o mdbook-linkcheck.zip "https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/v$MDBOOK_LINKCHECK_VER/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip" |
| 35 | + unzip mdbook-linkcheck.zip mdbook-linkcheck |
| 36 | + chmod +x mdbook-linkcheck |
31 | 37 |
|
32 | | - # FIXME: Keep this up to date |
33 | | - - name: Install mdbook-linkcheck |
34 | | - run: | # `-L` because GitHub performs a redirection |
35 | | - curl -L -o mdbook-linkcheck.zip "https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/v$MDBOOK_LINKCHECK_VER/mdbook-linkcheck.v$MDBOOK_LINKCHECK_VER.x86_64-unknown-linux-gnu.zip" |
36 | | - unzip mdbook-linkcheck.zip mdbook-linkcheck |
37 | | - chmod +x mdbook-linkcheck |
| 38 | + - name: Cache build dir |
| 39 | + uses: actions/cache@v4 |
| 40 | + with: |
| 41 | + path: gb-asm-tutorial/target/ |
| 42 | + key: ${{ runner.os }}-build-${{ hashFiles('gb-asm-tutorial/Cargo.lock') }} |
| 43 | + restore-keys: | |
| 44 | + ${{ runner.os }}-build- |
38 | 45 |
|
39 | | - - name: Cache build dir |
40 | | - uses: actions/cache@v4 |
41 | | - with: |
42 | | - path: gb-asm-tutorial/target/ |
43 | | - key: ${{ runner.os }}-build-${{ hashFiles('gb-asm-tutorial/Cargo.lock') }} |
44 | | - restore-keys: | |
45 | | - ${{ runner.os }}-build- |
| 46 | + - name: Build |
| 47 | + working-directory: gb-asm-tutorial/ |
| 48 | + env: |
| 49 | + MDBOOK_BUILD__CREATE_MISSING: "false" # Prevent creating missing files in SUMMARY.md |
| 50 | + MDBOOK_OUTPUT__LINKCHECK__COMMAND: "../mdbook-linkcheck" |
| 51 | + MDBOOK_OUTPUT__LINKCHECK__OPTIONAL: "false" |
| 52 | + run: | |
| 53 | + mdbook build |
| 54 | + for f in po/*.po; do |
| 55 | + lang=$(basename -s .po "$f") |
| 56 | + MDBOOK_BOOK__LANGUAGE="$lang" mdbook build -d book/"$lang" |
| 57 | + mv book/"$lang"/custom book/custom/"$lang" |
| 58 | + done |
46 | 59 |
|
47 | | - - name: Build |
48 | | - working-directory: gb-asm-tutorial/ |
49 | | - env: |
50 | | - MDBOOK_BUILD__CREATE_MISSING: "false" # Prevent creating missing files in SUMMARY.md |
51 | | - MDBOOK_OUTPUT__LINKCHECK__COMMAND: "../mdbook-linkcheck" |
52 | | - MDBOOK_OUTPUT__LINKCHECK__OPTIONAL: "false" |
53 | | - run: | |
54 | | - mdbook build |
55 | | - for f in po/*.po; do |
56 | | - lang=$(basename -s .po "$f") |
57 | | - MDBOOK_BOOK__LANGUAGE="$lang" mdbook build -d book/"$lang" |
58 | | - mv book/"$lang"/custom book/custom/"$lang" |
59 | | - done |
| 60 | + - name: Generate sitemap |
| 61 | + run: | |
| 62 | + cd gb-asm-tutorial/book/custom/ |
| 63 | + npx sscli --no-clean --base https://gbdev.io/gb-asm-tutorial |
60 | 64 |
|
61 | | - - name: Generate sitemap |
62 | | - run: | |
63 | | - cd gb-asm-tutorial/book/custom/ |
64 | | - npx sscli --no-clean --base https://gbdev.io/gb-asm-tutorial |
65 | | - |
66 | | - - name: Store final build |
67 | | - uses: actions/upload-pages-artifact@v3 |
68 | | - with: |
69 | | - path: gb-asm-tutorial/book/custom/ |
| 65 | + - name: Store final build |
| 66 | + uses: actions/upload-pages-artifact@v3 |
| 67 | + with: |
| 68 | + path: gb-asm-tutorial/book/custom/ |
70 | 69 |
|
71 | 70 | deploy: |
72 | 71 | name: Deploy to GitHub pages |
|
0 commit comments