-
Notifications
You must be signed in to change notification settings - Fork 1.7k
77 lines (62 loc) · 2.03 KB
/
publish.yml
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
77
name: Publish
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: pages
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
# Update the language picker in index.hbs to link new languages.
LANGUAGES: ar bn da de el es fa fr id it ja ko pl pt-BR ro ru tr uk vi zh-CN zh-TW
jobs:
publish:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # We need the full history for build.sh below.
- name: Setup Rust cache
uses: ./.github/workflows/setup-rust-cache
- name: Install Gettext
run: |
sudo apt update
sudo apt install gettext
- name: Install mdbook
uses: ./.github/workflows/install-mdbook
- name: Build course in English
run: .github/workflows/build.sh en book
- name: Build all translations
run: |
for po_lang in ${{ env.LANGUAGES }}; do
.github/workflows/build.sh $po_lang book/$po_lang
mv book/$po_lang/html book/html/$po_lang
done
- name: Build translation report
run: i18n-report report book/html/translation-report.html po/*.po
- name: Build synced translation report
run: |
cp -r po synced-po
MDBOOK_OUTPUT='{"xgettext": {"pot-file": "messages.pot", "granularity": 0}}' mdbook build -d synced-po
for file in synced-po/*.po; do msgmerge --update $file synced-po/messages.pot ; done
i18n-report report book/html/synced-translation-report.html synced-po/*.po
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: book/html
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4