From 40799e145377578f5e4cf54d79ce534c88043246 Mon Sep 17 00:00:00 2001 From: SkateSpots Date: Mon, 28 Sep 2026 14:00:06 +0700 Subject: [PATCH] fix: homepage is skate-spots.org (not .com) + skip no-op deploys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The package.json homepage pointed at skate-spots.com — a different domain on a different host, not this app. Also adds a deploy guard: auto-deploy.sh now hashes exactly what would be uploaded (dist/ + netlify/ + netlify.toml) and skips the Netlify deploy when it is byte-identical to what is already live, so metadata-only commits (version bumps, homepage) stop costing 15 credits. --- package.json | 2 +- scripts/auto-deploy.sh | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ddc345b..a25b30e 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "private": true, "version": "1.5.4", "type": "module", - "homepage": "https://skate-spots.com", + "homepage": "https://skate-spots.org", "scripts": { "dev": "npm i --silent && vite", "build": "npm i --silent && vite build -l error && cp dist/index.html dist/404.html && echo 'Project built successfully!'", diff --git a/scripts/auto-deploy.sh b/scripts/auto-deploy.sh index fd78e15..bc6a707 100755 --- a/scripts/auto-deploy.sh +++ b/scripts/auto-deploy.sh @@ -24,6 +24,7 @@ STATE_DIR="$HOME/.local/state/skatespots-deploy" SHA_FILE="$STATE_DIR/last-deployed-sha" LOCK_FILE="$STATE_DIR/last-lock-hash" INTERVAL_FILE="$STATE_DIR/last-deploy-epoch" +DIST_HASH_FILE="$STATE_DIR/last-dist-hash" mkdir -p "$STATE_DIR" # Production deploys cost 15 Netlify credits each, and this timer polls every @@ -125,10 +126,30 @@ if ! node scripts/smoke-test.mjs; then exit 1 fi -# 7. Deploy to Netlify production. +# 7. Skip the deploy entirely when the upload would be byte-identical to what is +# already live. Metadata-only changes (a package.json version/homepage, a dep +# bump that doesn't alter the bundle) otherwise burn a 15-credit production +# deploy for nothing. The snapshot covers exactly what `netlify deploy +# --dir=dist` uploads: dist/, netlify/ (functions) and netlify.toml. +snapshot_hash() { + { + find dist -type f -print0 2>/dev/null | sort -z | xargs -0 -r sha256sum + if [ -d netlify ]; then find netlify -type f -print0 | sort -z | xargs -0 -r sha256sum; fi + if [ -f netlify.toml ]; then sha256sum netlify.toml; fi + } | sha256sum | awk '{print $1}' +} +DIST_HASH="$(snapshot_hash)" +if [ -f "$DIST_HASH_FILE" ] && [ "$DIST_HASH" = "$(cat "$DIST_HASH_FILE")" ]; then + log "build output is unchanged from the live deploy — skipping Netlify (no credits spent)" + echo "$REMOTE_SHA" > "$SHA_FILE" + exit 0 +fi + +# 7b. Deploy to Netlify production. log "deploying to Netlify…" netlify deploy --prod --dir=dist echo "$REMOTE_SHA" > "$SHA_FILE" +echo "$DIST_HASH" > "$DIST_HASH_FILE" date +%s > "$INTERVAL_FILE" log "deployed ${REMOTE_SHA:0:9} ✓"