HT-14: PDF-lépés eltávolítva — csak HTML render
Build legal manifest / build-manifest (push) Successful in 22s
Build legal manifest / build-manifest (push) Successful in 22s
Az ÁSZF saját 3.2. pontja "megismerhető, megjeleníthető és letölthető" szöveget kér — ezt egy önálló (külső CSS/JS-függőség nélküli) HTML oldal is teljesíti (böngészőből menthető/nyomtatható), külön PDF-render nélkül. Ez NEM ugyanaz, mint a HRF-33/34 ajánlat-szerződés PDF-je — az egy ténylegesen elfogadott, hash-elt clickwrap-példány, más indokkal; azt nem érinti ez a változás. Egyszerűsödött CI-környezet: WeasyPrint + natív libek (pango/cairo) törölve, csak pandoc + python3 kell. A manifest "pdf" mezője megszűnt. A rendereletHTML immár kicsi (nincs PDF), ezért a teljes dist/ kimenet visszacommitolódik "manifest/" néven (nem csak a JSON) — a fogyasztók ugyanazzal a git clone-nal a HTML-t is megkapják, nem csak a metaadatot.
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
name: Build legal manifest
|
name: Build legal manifest
|
||||||
|
|
||||||
# HT-14: renders every project's legal markdown to HTML+PDF and produces
|
# HT-14: renders every project's legal markdown to HTML and produces
|
||||||
# dist/legal-manifest.json — the single canonical source HT-15's consumer backends import,
|
# dist/legal-manifest.json — the single canonical source HT-15's consumer backends import,
|
||||||
# so no one hashes/versions independently. See scripts/build-manifest.py for the actual
|
# so no one hashes/versions independently. See scripts/build-manifest.py for the actual
|
||||||
# logic; this workflow just provides the environment it needs.
|
# logic (and why there's no PDF step); this workflow just provides the environment it needs.
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -24,50 +24,30 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
# The CI environment: a plain ubuntu-latest job container (act_runner default image),
|
# The CI environment: a plain ubuntu-latest job container (act_runner default image),
|
||||||
# with pandoc (markdown -> HTML, per HT-14) and WeasyPrint (HTML -> PDF, same
|
# with pandoc (markdown -> HTML, per HT-14) installed as an explicit step — not baked
|
||||||
# approach already proven deterministic for ResidentFirst's HRF-34 offer contracts)
|
# into a custom runner image, so the environment stays visible and reproducible
|
||||||
# installed as an explicit step — not baked into a custom runner image, so the
|
# directly from this file.
|
||||||
# environment stays visible and reproducible directly from this file.
|
- name: Install pandoc
|
||||||
- name: Install pandoc + WeasyPrint
|
run: apt-get update -qq && apt-get install -y --no-install-recommends pandoc python3
|
||||||
run: |
|
|
||||||
apt-get update -qq
|
|
||||||
apt-get install -y --no-install-recommends \
|
|
||||||
pandoc python3 python3-pip python3-venv \
|
|
||||||
libpango-1.0-0 libpangoft2-1.0-0 fonts-dejavu-core
|
|
||||||
python3 -m venv /tmp/venv
|
|
||||||
/tmp/venv/bin/pip install --quiet weasyprint==69.0
|
|
||||||
echo "/tmp/venv/bin" >> "$GITHUB_PATH"
|
|
||||||
|
|
||||||
- name: Build manifest
|
- name: Build manifest
|
||||||
run: python3 scripts/build-manifest.py
|
run: python3 scripts/build-manifest.py
|
||||||
|
|
||||||
# v4 uses a newer artifact-storage protocol this Gitea version doesn't implement yet
|
# The rendered HTML is now small (no PDF, see build-manifest.py) — committing the
|
||||||
# ("GHESNotSupportedError", confirmed empirically) — v3 uses the older, supported one.
|
# whole dist/ output back to the repo consumers already git-clone for the markdown
|
||||||
# Convenience only (manual inspection via the Actions UI) — HT-15 consumers should NOT
|
# sources is cheap and avoids the Gitea Actions artifact API entirely (its repo-level
|
||||||
# depend on this: the repo-level list-artifacts API returned empty even after a
|
# list-artifacts endpoint returned empty even after a confirmed-successful upload in
|
||||||
# successful v3 upload (a Gitea REST API gap, not a real absence — the run's own job
|
# an earlier version of this workflow — a REST API gap, not worth depending on).
|
||||||
# log confirms the upload step succeeded). The commit-back step below is the real,
|
- name: Commit manifest + rendered HTML back to repo
|
||||||
# dependable distribution path.
|
|
||||||
- name: Upload manifest + rendered artifacts (convenience only, see note above)
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: legal-manifest
|
|
||||||
path: dist/
|
|
||||||
|
|
||||||
# The dependable distribution path for HT-15: just the small JSON manifest (not the
|
|
||||||
# bulkier rendered HTML/PDF, to avoid repo bloat over time) committed back to the repo
|
|
||||||
# consumers already git-clone for the markdown sources — no Gitea Actions artifact API
|
|
||||||
# involved at all.
|
|
||||||
- name: Commit manifest back to repo
|
|
||||||
run: |
|
run: |
|
||||||
mkdir -p manifest
|
rm -rf manifest
|
||||||
cp dist/legal-manifest.json manifest/legal-manifest.json
|
cp -r dist manifest
|
||||||
git config user.name "H2W Legal CI"
|
git config user.name "H2W Legal CI"
|
||||||
git config user.email "[email protected]"
|
git config user.email "[email protected]"
|
||||||
git add manifest/legal-manifest.json
|
git add manifest
|
||||||
if git diff --cached --quiet; then
|
if git diff --cached --quiet; then
|
||||||
echo "Manifest változatlan — nincs mit commitolni."
|
echo "Manifest változatlan — nincs mit commitolni."
|
||||||
else
|
else
|
||||||
git commit -m "CI: legal-manifest.json frissítve [skip ci]"
|
git commit -m "CI: legal-manifest.json + renderelt HTML frissítve [skip ci]"
|
||||||
git push origin HEAD:main
|
git push origin HEAD:main
|
||||||
fi
|
fi
|
||||||
|
|||||||
+15
-17
@@ -1,14 +1,23 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""Builds dist/legal-manifest.json (HT-14): renders each project's markdown legal documents
|
"""Builds dist/legal-manifest.json (HT-14): renders each project's markdown legal documents
|
||||||
to HTML+PDF and computes a content_hash, producing the single canonical manifest every
|
to HTML and computes a content_hash, producing the single canonical manifest every consumer
|
||||||
consumer backend imports at deploy time (HT-15) instead of hashing independently.
|
backend imports at deploy time (HT-15) instead of hashing independently.
|
||||||
|
|
||||||
|
HTML only, no PDF: the ÁSZF's own 3.2. clause requires the text to be "megismerhető,
|
||||||
|
megjeleníthető és letölthető" (accessible, viewable, downloadable) before acceptance — a
|
||||||
|
self-contained HTML page (no external CSS/JS) satisfies that on its own (savable/printable
|
||||||
|
from the browser) without a separate render step. Unlike HRF-33/34's offer-contract PDF —
|
||||||
|
that one is a *formally accepted, hashed instance* via clickwrap, a genuinely different
|
||||||
|
requirement — nothing here is "accepted" as a fixed artifact, so there's no reason to add a
|
||||||
|
second render toolchain (pandoc's PDF path needs a LaTeX/wkhtmltopdf/WeasyPrint engine) just
|
||||||
|
to reproduce what the browser already does with an HTML page opened in a new tab.
|
||||||
|
|
||||||
content_hash source (interim, per the HT-3 "Design döntés" comment): the source markdown's
|
content_hash source (interim, per the HT-3 "Design döntés" comment): the source markdown's
|
||||||
git blob hash (`git hash-object`), NOT the rendered artifact's hash yet — that requires a
|
git blob hash (`git hash-object`), NOT the rendered artifact's hash yet — that requires a
|
||||||
proven byte-for-byte-deterministic render, which this pandoc+WeasyPrint combination hasn't
|
proven byte-for-byte-deterministic render, which hasn't been tested for the pandoc HTML step
|
||||||
been tested for (ResidentFirst's HRF-34 proved a *different* render pipeline deterministic,
|
(ResidentFirst's HRF-34 proved a *different* pipeline deterministic, not this one). Switching
|
||||||
not this one). Switching later doesn't invalidate old receipts, since a receipt is bound to
|
later doesn't invalidate old receipts, since a receipt is bound to document_version, not
|
||||||
document_version, not content_hash alone.
|
content_hash alone.
|
||||||
|
|
||||||
effective_from source: parsed from each document's own "Hatálybalépés napja: <dátum>" line —
|
effective_from source: parsed from each document's own "Hatálybalépés napja: <dátum>" line —
|
||||||
the one human-controlled field carrying the legally relevant date. A document whose date is
|
the one human-controlled field carrying the legally relevant date. A document whose date is
|
||||||
@@ -78,14 +87,6 @@ def render_html(markdown_path: Path, html_path: Path) -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def render_pdf(html_path: Path, pdf_path: Path) -> None:
|
|
||||||
from weasyprint import HTML
|
|
||||||
|
|
||||||
# full_fonts=True: WeasyPrint's default font subsetting is not byte-for-byte
|
|
||||||
# deterministic (confirmed empirically while building HRF-34) — full embedding is.
|
|
||||||
HTML(filename=str(html_path)).write_pdf(str(pdf_path), full_fonts=True)
|
|
||||||
|
|
||||||
|
|
||||||
def build_manifest_for_project(project_dir: Path) -> dict:
|
def build_manifest_for_project(project_dir: Path) -> dict:
|
||||||
manifest = {}
|
manifest = {}
|
||||||
for md_path in sorted(project_dir.glob("*.md")):
|
for md_path in sorted(project_dir.glob("*.md")):
|
||||||
@@ -95,17 +96,14 @@ def build_manifest_for_project(project_dir: Path) -> dict:
|
|||||||
out_dir = OUTPUT_DIR / project_dir.name
|
out_dir = OUTPUT_DIR / project_dir.name
|
||||||
out_dir.mkdir(parents=True, exist_ok=True)
|
out_dir.mkdir(parents=True, exist_ok=True)
|
||||||
html_path = out_dir / f"{doc_type}.html"
|
html_path = out_dir / f"{doc_type}.html"
|
||||||
pdf_path = out_dir / f"{doc_type}.pdf"
|
|
||||||
|
|
||||||
render_html(md_path, html_path)
|
render_html(md_path, html_path)
|
||||||
render_pdf(html_path, pdf_path)
|
|
||||||
|
|
||||||
manifest[doc_type] = {
|
manifest[doc_type] = {
|
||||||
"version": last_commit_hash(md_path),
|
"version": last_commit_hash(md_path),
|
||||||
"effective_from": parse_effective_from(markdown),
|
"effective_from": parse_effective_from(markdown),
|
||||||
"content_hash": git_blob_hash(md_path),
|
"content_hash": git_blob_hash(md_path),
|
||||||
"html": f"{project_dir.name}/{doc_type}.html",
|
"html": f"{project_dir.name}/{doc_type}.html",
|
||||||
"pdf": f"{project_dir.name}/{doc_type}.pdf",
|
|
||||||
}
|
}
|
||||||
return manifest
|
return manifest
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user