#!/usr/bin/env bash # Put the worker dashboard page next to the fleet page and deploy the folder through publish-fleet.sh's mechanism. # tools/workers/publish-workers.sh copy workers.html, shape.js, workers.demo.json; one push.mjs pass; deploy # tools/workers/publish-workers.sh --no-deploy copy only (the fleet orchestrator's next deploy carries it) # The folder is $DLSITE// (dlsite-dir and fleet-path in ~/.config/igneum). The fleet index.html gets the # Workers nav link if it does not carry one yet (the fleet page has no repo source; this is the only edit made to it). set -euo pipefail HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"; ROOT="$(cd "$HERE/../.." && pwd)" DLSITE="$(cat "$HOME/.config/igneum/dlsite-dir")"; P="$(cat "$HOME/.config/igneum/fleet-path")" DIR="$DLSITE/$P"; [ -d "$DIR" ] || { echo "no $DIR" >&2; exit 1; } cp "$HERE/page/workers.html" "$DIR/workers.html" cp "$HERE/shape.js" "$DIR/shape.js" cp "$HERE/fixtures/workers.demo.json" "$DIR/workers.demo.json" if ! grep -q 'workers.html' "$DIR/index.html"; then python3 - "$DIR/index.html" <<'PY' import sys, re p = sys.argv[1]; s = open(p).read() css = " nav { display: flex; gap: 2px; border: 1px solid var(--line); }\n nav a { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); text-decoration: none; padding: 7px 12px; }\n nav a.on { color: var(--ink); background: var(--panel-2); }\n nav a:hover { color: var(--ember-2); }\n" s = s.replace(" .live {", css + " .live {", 1) s = s.replace('
', ' \n
', 1) open(p, 'w').write(s) print("nav link added to the fleet index.html") PY fi node "$HERE/push.mjs" --no-deploy if [ "${1:-}" != --no-deploy ]; then tmp="$(mktemp)"; cp "$DIR/fleet.json" "$tmp" "$ROOT/tools/fleet/publish-fleet.sh" "$tmp" >/dev/null || "/Users/joshm/Projects/igneum/tools/fleet/publish-fleet.sh" "$tmp" rm -f "$tmp" for i in $(seq 1 12); do if curl -fsS --max-time 10 "https://dl.igneum.network/$P/workers.html?t=$(date +%s)" | grep -c "Igneum Workers" >/dev/null; then echo "live: https://dl.igneum.network/$P/workers.html"; exit 0; fi sleep 5 done echo "deployed but the edge does not serve workers.html yet" >&2; exit 2 fi