feat(release): build and publish EPUB artifacts per language (#54)

Extend the release workflow to build separate EPUB artifacts for en, vi,
and zh in parallel via a matrix job, then publish all built files under
a single GitHub Release. Using fail-fast: false so a failure in one
language does not block releasing the others.

Also refactor build_epub.py to drive language-specific paths, filenames,
and titles from a mapping, and add zh support (title/subtitle + choice).
This commit is contained in:
Thiên Toán
2026-04-07 14:14:06 +07:00
committed by GitHub
parent 2cbb10c959
commit 90e9c30e93
2 changed files with 66 additions and 17 deletions
+49 -4
View File
@@ -7,9 +7,14 @@ on:
jobs:
build:
name: Build EPUB (${{ matrix.lang }})
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
# Don't cancel other languages if one fails — we still want to release
# whichever languages built successfully.
fail-fast: false
matrix:
lang: [en, vi, zh]
steps:
- uses: actions/checkout@v4
@@ -25,11 +30,51 @@ jobs:
- name: Install Mermaid CLI
run: npm install -g @mermaid-js/mermaid-cli
- name: Install Python dependencies
run: |
uv venv
uv pip install -r scripts/requirements-dev.txt
- name: Build EPUB
run: uv run scripts/build_epub.py
run: |
echo '{"args":["--no-sandbox","--disable-setuid-sandbox"]}' > /tmp/puppeteer-ci.json
uv run scripts/build_epub.py \
--lang ${{ matrix.lang }} \
--puppeteer-config /tmp/puppeteer-ci.json
- name: Upload EPUB artifact
uses: actions/upload-artifact@v4
with:
name: epub-${{ matrix.lang }}
path: claude-howto-guide*.epub
if-no-files-found: error
retention-days: 7
release:
name: Publish GitHub Release
needs: build
# Release even if some language builds failed — we still publish the
# artifacts that did build. `needs.build.result != 'cancelled'` guards
# against manually cancelled runs.
if: ${{ always() && needs.build.result != 'cancelled' }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all EPUB artifacts
uses: actions/download-artifact@v4
with:
path: dist
pattern: epub-*
merge-multiple: true
- name: List built artifacts
run: ls -lh dist/
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: claude-howto-guide.epub
files: dist/*.epub
generate_release_notes: true
fail_on_unmatched_files: true