#!/bin/sh set -eu # Top-level build script — builds all ZDDC HTML tools, the zddc-server # binaries, and the downloadable bundles (install.zip and track-*.zip). SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) echo "=== Building ZDDC tools ===" sh "$SCRIPT_DIR/transmittal/build.sh" "${1:-}" "${2:-}" sh "$SCRIPT_DIR/archive/build.sh" "${1:-}" "${2:-}" sh "$SCRIPT_DIR/classifier/build.sh" "${1:-}" "${2:-}" sh "$SCRIPT_DIR/mdedit/build.sh" "${1:-}" "${2:-}" sh "$SCRIPT_DIR/landing/build.sh" "${1:-}" "${2:-}" echo "" echo "=== Assembling zddc/dist/web/ ===" # Only landing and archive ship inside the server bundle: they call the # server's JSON API (GET / for the project list, directory listings for the # archive) and are useless without it. transmittal, classifier, and mdedit # are pure client-side tools that work from file:// or any static host; # they are released to website/ for download but not bundled with the server. mkdir -p "$SCRIPT_DIR/zddc/dist/web" cp "$SCRIPT_DIR/landing/dist/index.html" "$SCRIPT_DIR/zddc/dist/web/index.html" cp "$SCRIPT_DIR/archive/dist/archive.html" "$SCRIPT_DIR/zddc/dist/web/archive.html" echo "Wrote zddc/dist/web/index.html" echo "Wrote zddc/dist/web/archive.html" # Cross-compiled zddc-server binaries are built via podman if available # (no-op otherwise — CI builds the runtime container directly via the # Containerfile's builder stage and doesn't need host-side binaries). echo "" echo "=== Building zddc-server binaries ===" if command -v podman >/dev/null 2>&1; then podman build --target binaries -o "$SCRIPT_DIR/zddc/dist/" "$SCRIPT_DIR/zddc/" 2>&1 | grep -v "^-->" else echo "podman not found — skipping cross-compiled binary build." echo " (CI builds the container image directly; this step only matters" echo " for releasing the standalone Linux/macOS/Windows binaries.)" fi # ─── Bootstrap zips ────────────────────────────────────────────────────────── # Generated from bootstrap/level{1,2}.html.tmpl on every build so they are # always in sync with the current bootstrap pattern. # # install.zip — drop into deployment root for self-contained install. # Contains the 5 current-stable HTMLs at root plus a # _template/ directory with 4 level-1 stubs that # projects can use as their starting layout. # track-.zip — drop the level-2 stubs over deployment root to make # the whole site track from zddc.varasys.io. # # install.zip needs at least one stable release to exist under # website/releases/; if none exist yet, that zip is skipped with a warning. WEBSITE_DIR="$SCRIPT_DIR/website" RELEASES_DIR="$WEBSITE_DIR/releases" BOOTSTRAP_DIR="$SCRIPT_DIR/bootstrap" mkdir -p "$WEBSITE_DIR" # tool|filename|title TOOL_TABLE='archive|archive.html|Archive transmittal|transmittal.html|Transmittal classifier|classifier.html|Classifier mdedit|mdedit.html|Markdown Editor landing|index.html|ZDDC' # Substitute {{TOOL}}, {{TOOL_TITLE}}, {{CHANNEL}} in a template. # Substitute {{TOOL}}, {{TOOL_TITLE}}, {{CHANNEL}} in a template. render_stub() { sed \ -e "s|{{TOOL_TITLE}}|$3|g" \ -e "s|{{TOOL}}|$2|g" \ -e "s|{{CHANNEL}}|${4:-}|g" \ "$1" > "$5" } build_install_zip() { # Verify a stable release exists for every tool before staging. _missing="" while IFS='|' read -r _tool _file _title; do [ -e "$RELEASES_DIR/${_tool}_stable.html" ] || _missing="$_missing $_tool" done < Releases — ZDDC

Releases

All published versions and channel builds of every ZDDC tool. Stable releases are immutable; alpha and beta channels are rebuilt without notice.

HEAD printf '%s\n' "$TOOL_TABLE" | while IFS='|' read -r _tool _file _title; do _stable_target="" if [ -L "$RELEASES_DIR/${_tool}_stable.html" ]; then _stable_target=$(readlink "$RELEASES_DIR/${_tool}_stable.html") fi printf '
\n' printf '

%s

\n' "$_title" printf '
\n' [ -e "$RELEASES_DIR/${_tool}_stable.html" ] && printf ' stable\n' "$_tool" [ -e "$RELEASES_DIR/${_tool}_beta.html" ] && printf ' beta\n' "$_tool" [ -e "$RELEASES_DIR/${_tool}_alpha.html" ] && printf ' alpha\n' "$_tool" printf '
\n' _versions=$(ls -1 "$RELEASES_DIR" 2>/dev/null | grep -E "^${_tool}_v[0-9]" | sort -V -r) if [ -n "$_versions" ]; then printf '
Pin to version:\n' printf '%s\n' "$_versions" | while read -r _v; do _ver=${_v#${_tool}_v}; _ver=${_ver%.html} printf ' v%s\n' "$_v" "$_ver" done printf '
\n' fi if [ -n "$_stable_target" ]; then printf '
stable currently → %s
\n' "$_stable_target" fi printf '
\n' done cat <<'TAIL'

Append ?v=alpha, ?v=beta, ?v=stable, or ?v=0.0.1 to any deployment URL to switch versions for a single request — see the home page.

TAIL } > "$_out" echo "Wrote $_out" } echo "" echo "=== Building install.zip, track-*.zip, releases/index.html ===" build_install_zip build_track_zip alpha build_track_zip beta build_track_zip stable build_releases_index echo "" echo "=== All tools built successfully ===" echo "" echo "Server deployment package: zddc/dist/" echo " Binaries: zddc-server-{linux,darwin,windows}-*" echo " Web files: web/ (copy contents to ZDDC_ROOT)" echo "" echo "Bootstrap downloads: website/" echo " install.zip — self-contained install for deployment root" echo " track-alpha.zip — level-2 stubs that track the alpha channel" echo " track-beta.zip — level-2 stubs that track the beta channel" echo " track-stable.zip — level-2 stubs that track the stable channel"