-
-
Notifications
You must be signed in to change notification settings - Fork 56
76 lines (65 loc) · 2.18 KB
/
build-and-deploy.yml
File metadata and controls
76 lines (65 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Build and deploy an updated version of the website
on: [push, pull_request]
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
env:
MDBOOK_VERSION: 0.5.2
MDBOOK_LINKCHECK2_VERSION: 0.12.0
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: dtolnay/rust-toolchain@stable
- name: Checkout gb-asm-tutorial
uses: actions/checkout@v2
with:
path: gb-asm-tutorial
- name: Install mdbook dependencies
run: |
cargo install mdbook@${MDBOOK_VERSION}
cargo install mdbook-linkcheck2@${MDBOOK_LINKCHECK2_VERSION}
- name: Install static-sitemap-cli
run: npm install static-sitemap-cli
- name: Cache build dir
uses: actions/cache@v4
with:
path: gb-asm-tutorial/target/
key: ${{ runner.os }}-build-${{ hashFiles('gb-asm-tutorial/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-build-
- name: Build
working-directory: gb-asm-tutorial/
env:
MDBOOK_BUILD__CREATE_MISSING: "false" # Prevent creating missing files in SUMMARY.md
MDBOOK_OUTPUT__LINKCHECK2__OPTIONAL: "false"
run: |
mdbook build
for f in po/*.po; do
lang=$(basename -s .po "$f")
MDBOOK_BOOK__LANGUAGE="$lang" mdbook build -d book/"$lang"
mv book/"$lang"/custom book/custom/"$lang"
done
- name: Generate sitemap
run: |
cd gb-asm-tutorial/book/custom/
npx sscli --no-clean --base https://gbdev.io/gb-asm-tutorial
- name: Store final build
uses: actions/upload-pages-artifact@v3
with:
path: gb-asm-tutorial/book/custom/
deploy:
name: Deploy to GitHub pages
# Do not run this unless *pushing* to `master`.
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4