mirror of
https://github.com/luongnv89/claude-howto.git
synced 2026-12-03 02:03:31 +01:00
* refactor(website): render diagrams with pinned pele bundle (#195) * refactor(ci): validate diagrams with pele and fail when missing (#195) * refactor(epub): render diagrams as flattened pele svg (#195) * docs: document pele diagram rendering and node 20 setup (#195) * test(epub): assert numbered labels reach pele unescaped (#195) * fix(scripts): address review feedback (#195) * fix(website): keep pele zoom controls off diagram labels (#195) Pele (zoom: 'auto') draws an opaque zoom box over the top-right corner of every diagram it shrinks to fit, which hid labels. When that box is shown, div.mermaid now gets top padding so the diagram starts below it. Top room rather than side room: Pele lays diagrams out to the content width, so side padding would shrink them further and re-lay them out. Zoom also makes each shrunk diagram a tab stop, but the SVG had no accessible name. Name every SVG Pele draws after the nearest heading plus its diagram kind ("Architecture - flowchart"). Pele draws a new <svg> on resize and font load, so the name is set in onRender. SVGs named by accTitle keep their own name. * fix(scripts): load the cached pele bundle as ESM on node 20 (#195) pele_render.mjs imports Pele's ES module build, dist/pele.js, which was cached as a bare pele.js with no package.json "type": "module" beside it. Node.js 20.0-20.18 and 22.0-22.6 have no ESM syntax detection, so they load that file as CommonJS and crash on `export`, failing check_mermaid.py and build_epub.py on a supported Node. Cache dist/pele.js as pele.mjs (the same sha256-pinned file) and hand that path to the helper, so every Node.js >= 20 loads it as an ES module. A cache holding only pele.js downloads and verifies pele.mjs once. A test turns off syntax detection to reproduce the old Node behaviour on newer Node.
78 lines
2.0 KiB
YAML
78 lines
2.0 KiB
YAML
name: Build and Release EPUB
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
build:
|
|
name: Build EPUB (${{ matrix.lang }})
|
|
runs-on: ubuntu-latest
|
|
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
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v4
|
|
|
|
# Pele renders the diagrams and needs Node.js >= 20.
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- 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 --lang ${{ matrix.lang }}
|
|
|
|
- name: Verify EPUB diagrams
|
|
run: python3 scripts/check_epub_diagrams.py claude-howto-guide*.epub
|
|
|
|
- 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: dist/*.epub
|
|
generate_release_notes: true
|
|
fail_on_unmatched_files: true
|