Skip to content

Commit bc378d6

Browse files
orangecmspamolloy
authored andcommitted
move all build steps from CI to Makefile and i18n.sh
Signed-off-by: Daniel Maslowski <info@orangecms.org>
1 parent 2a33480 commit bc378d6

4 files changed

Lines changed: 33 additions & 21 deletions

File tree

.github/workflows/gh-pages.yml

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ on:
66
- main
77
pull_request:
88

9-
env:
10-
# Update the language picker in theme/js/language-picker.js to link new languages.
11-
LANGUAGES: zh-TW
12-
139
jobs:
1410
deploy:
1511
runs-on: ubuntu-24.04
@@ -38,22 +34,7 @@ jobs:
3834
run: make prepare_i18n
3935

4036
- name: Build
41-
# linkcheck causes ouput files to end up in html/, so move them to root
42-
run: |
43-
mdbook build
44-
mv book/html/* book/
45-
46-
- name: Build all translations
47-
run: |
48-
for po_lang in ${{ env.LANGUAGES }}; do
49-
echo "::group::Building $po_lang translation"
50-
MDBOOK_BOOK__LANGUAGE=$po_lang \
51-
MDBOOK_OUTPUT__HTML__SITE_URL=/linuxboot-book/$po_lang/ \
52-
mdbook build -d book/$po_lang
53-
rsync -a book/$po_lang/html/ book/$po_lang/
54-
rm -r book/$po_lang/html/
55-
echo "::endgroup::"
56-
done
37+
run: make build
5738

5839
- name: Deploy
5940
uses: peaceiris/actions-gh-pages@v3

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
build:
1+
build: book i18n
2+
# linkcheck causes output files to end up in html/, so move them to root
3+
mv book/html/* book/
4+
5+
i18n:
6+
bash i18n.sh
7+
8+
book:
29
mdbook build
310

411
run:

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ From the root directory of the repository run `mdl /src/example.md` and `vale
3838
src/example.md`. Add words that trigger false positive spelling errors to
3939
`ci/vale/styles/config/vocabularies/LinuxBoot/accept.txt`.
4040

41+
## I18n
42+
43+
Translations are in [`po/`](po/). They are built with [`i18n.sh`](i18n.sh).
44+
Until there is a native mdBook plugin, see the [`Makefile`](Makefile) for how
45+
the translations are integrated.
46+
47+
Note that `make run` / `mdbook serve` do not integrate the translations at this
48+
point. The `make build` target will build everything into `book/`, which you
49+
can then statically serve.
50+
4151
## Acknowledgments
4252

4353
In alphabetical order:

i18n.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
3+
# Update the language picker in theme/js/language-picker.js to add new languages.
4+
LANGUAGES=zh-TW
5+
6+
for po_lang in ${LANGUAGES}; do
7+
echo "::group::Building $po_lang translation"
8+
MDBOOK_BOOK__LANGUAGE=$po_lang \
9+
MDBOOK_OUTPUT__HTML__SITE_URL=/linuxboot-book/$po_lang/ \
10+
mdbook build -d book/$po_lang
11+
# NOTE: This is crucial. Put the files in the right place.
12+
rsync -a book/$po_lang/html/ book/$po_lang/
13+
echo "::endgroup::"
14+
done

0 commit comments

Comments
 (0)