← back to Dw Theme Patches

TK-12166/deploy.sh

15 lines

#!/usr/bin/env bash
# TK-12166 — push the Brand McKenzie Lead Time row to the LIVE theme (one asset only).
# Refuses if the live file drifted from the backup taken 2026-09-24. Undo: ./restore.sh
source "$(cd "$(dirname "$0")" && pwd)/_lib.sh"
EXPECT="$(cat "$HERE/backup.sha256")"; NEW="$HERE/product-description-meta.liquid"
LIVE="$(mktemp)"; fetch_live "$LIVE"; CUR="$(sha_of "$LIVE")"
echo "live sha256    : $CUR"; echo "backup sha256  : $EXPECT"
if [ "$CUR" != "$EXPECT" ]; then
  echo "ABORT: live $KEY has DRIFTED since backup — re-take backup + re-apply patch. Nothing pushed."; diff -u "$HERE/product-description-meta.liquid.backup" "$LIVE" | head -40; exit 2; fi
[ "${DRY_RUN:-0}" = "1" ] && { echo "DRY_RUN=1 — drift check passed, not pushing."; exit 0; }
put_asset "$NEW"
WANT="$(sha_of "$NEW")"; for i in 1 2 3 4 5 6; do sleep 2; fetch_live "$LIVE"; AFTER="$(sha_of "$LIVE")"; [ "$AFTER" = "$WANT" ] && break; done  # asset reads lag the PUT by a few seconds
echo "new live sha256: $AFTER"; echo "patched sha256 : $WANT"
[ "$AFTER" = "$WANT" ] && echo "OK: deployed. Now run: node $HERE/verify.mjs   (undo: $HERE/restore.sh)" || { echo "WARN: live sha != patched file — inspect"; exit 3; }