Skip to content

Commit 130ba68

Browse files
committed
manual-pdf: convert all languages and run in parallel matrix
1 parent 40b6fe8 commit 130ba68

File tree

1 file changed

+35
-3
lines changed

1 file changed

+35
-3
lines changed

.github/workflows/manual-pdf.yml

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,35 @@
11
name: Manual to PDF
22
on: [pull_request, push]
33
jobs:
4+
discover:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Checkout repository
8+
uses: actions/checkout@v6
9+
10+
- name: Discover language HTML files
11+
id: langs
12+
run: |
13+
set -euo pipefail
14+
# Find language-specific HTML files (exclude index.html) and emit single-line JSON array of langs
15+
langs_json="$(
16+
find user_guide -maxdepth 1 -name '*.html' ! -name 'index.html' -print0 \
17+
| xargs -0 -n1 -I{} bash -lc 'basename "{}" .html' \
18+
| jq -R . | jq -s -c .
19+
)"
20+
echo "Found languages: ${langs_json}"
21+
printf 'langs=%s\n' "$langs_json" >> "$GITHUB_OUTPUT"
22+
23+
outputs:
24+
langs: ${{ steps.langs.outputs.langs }}
25+
426
convert:
27+
needs: discover
528
runs-on: ubuntu-latest
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
lang: ${{ fromJSON(needs.discover.outputs.langs) }}
633
steps:
734
- name: Checkout repository
835
uses: actions/checkout@v6
@@ -14,10 +41,15 @@ jobs:
1441
version: 1.0
1542

1643
- name: Convert HTML to PDF
17-
run: weasyprint --full-fonts user_guide/index.html koreader_user_guide.pdf
44+
run: |
45+
set -euo pipefail
46+
f="user_guide/${{ matrix.lang }}.html"
47+
out="koreader_user_guide_${{ matrix.lang }}.pdf"
48+
echo "Converting $f -> $out"
49+
weasyprint --full-fonts "$f" "$out"
1850
1951
- name: Upload
2052
uses: actions/upload-artifact@v5
2153
with:
22-
name: KOReader Manual PDF
23-
path: koreader_user_guide.pdf
54+
name: KOReader Manual PDF - ${{ matrix.lang }}
55+
path: koreader_user_guide_${{ matrix.lang }}.pdf

0 commit comments

Comments
 (0)