[object Object]

← back to Coming Soon Template

Add Cloudflare Pages deploy script — artifact-dir only, never project root

67ff39cb6155c3114819818ea3d7860604a76fa5 · 2026-05-18 10:09:17 -0700 · SteveStudio2

Files touched

Diff

commit 67ff39cb6155c3114819818ea3d7860604a76fa5
Author: SteveStudio2 <steve@designerwallcoverings.com>
Date:   Mon May 18 10:09:17 2026 -0700

    Add Cloudflare Pages deploy script — artifact-dir only, never project root
---
 deploy.sh | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/deploy.sh b/deploy.sh
new file mode 100755
index 0000000..71c0a03
--- /dev/null
+++ b/deploy.sh
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+# Deploy a coming-soon page to Cloudflare Pages.
+#
+#   ./deploy.sh abramsindex.com      # deploy one domain
+#   ./deploy.sh all                  # deploy every domain under out/
+#
+# HARD RULE (debate-team verdict, 2026-05-18): only ever publish the
+# per-domain artifact dir `out/<domain>/` — never the project root.
+# Deploying the project root is what leaked .credentials.local /
+# users.json on the prior laptop session. This script makes that
+# mistake structurally impossible.
+set -euo pipefail
+cd "$(dirname "$0")"
+
+[ -f .env ] || { echo "✗ missing .env (CLOUDFLARE_PAGES_TOKEN + CLOUDFLARE_ACCOUNT_ID)"; exit 1; }
+set -a; source .env; set +a
+# wrangler reads CLOUDFLARE_API_TOKEN; our master .env stores the
+# Pages-scoped token separately so it never clobbers the DNS token.
+export CLOUDFLARE_API_TOKEN="${CLOUDFLARE_PAGES_TOKEN:?CLOUDFLARE_PAGES_TOKEN not set}"
+
+deploy_one() {
+  local dir="$1"
+  [ -d "out/$dir" ] || { echo "✗ no artifact: out/$dir"; return 1; }
+  local project="${dir%.com}"          # abramsindex.com -> abramsindex
+  echo "→ deploying $dir  (project: $project)"
+  npx --yes wrangler pages deploy "out/$dir" \
+    --project-name="$project" --branch=main --commit-dirty=true
+}
+
+target="${1:?usage: deploy.sh <domain-dir under out/> | all}"
+if [ "$target" = "all" ]; then
+  for d in out/*/; do
+    d="${d#out/}"; d="${d%/}"
+    [ -f "out/$d/index.html" ] && deploy_one "$d"
+  done
+else
+  deploy_one "$target"
+fi

← 298fd1e snapshot: backup uncommitted work (1 files)  ·  back to Coming Soon Template  ·  add CF zone-create + GoDaddy NS-flip scripts for 21 abrams/b 5341e99 →