Spaces:
Running
Running
cheikhaidev-ui commited on
Commit ·
fdeb5cf
1
Parent(s): 86fcf4d
chore: sync 4 commit(s) from main (text-only, binaries excluded)
Browse filesac3dff6 chore: add push-hf.sh script to automate HF deploy
6c0a2e1 chore: ignore check-*.png verification screenshots
21cbc46 docs(readme): use absolute GitHub raw URLs for screenshots
55deea4 docs(readme): add screenshots section with 3 Playwright captures from live HF Space
- .gitignore +2 -1
- scripts/push-hf.sh +72 -0
.gitignore
CHANGED
|
@@ -17,4 +17,5 @@ screenshots/check-*.png
|
|
| 17 |
node_modules/
|
| 18 |
package.json
|
| 19 |
package-lock.json
|
| 20 |
-
scripts/
|
|
|
|
|
|
| 17 |
node_modules/
|
| 18 |
package.json
|
| 19 |
package-lock.json
|
| 20 |
+
scripts/*
|
| 21 |
+
!scripts/push-hf.sh
|
scripts/push-hf.sh
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# push-hf.sh — Sync text-only changes from main to the HF Space remote.
|
| 3 |
+
#
|
| 4 |
+
# Usage: bash scripts/push-hf.sh
|
| 5 |
+
#
|
| 6 |
+
# HF rejects binary files (Xet policy); screenshots live on GitHub raw.
|
| 7 |
+
# This script builds a binary-free commit on top of HF's history and pushes it.
|
| 8 |
+
|
| 9 |
+
set -euo pipefail
|
| 10 |
+
|
| 11 |
+
REMOTE="hf"
|
| 12 |
+
DEPLOY_BRANCH="hf-deploy"
|
| 13 |
+
BINARY_EXT='\.(png|jpg|jpeg|gif|webp|ico|pdf|zip|tar\.gz|woff2?|ttf|eot)$'
|
| 14 |
+
|
| 15 |
+
echo "→ Fetching $REMOTE…"
|
| 16 |
+
git fetch "$REMOTE" --quiet
|
| 17 |
+
|
| 18 |
+
# Detect text-only changes between HF tip and local main
|
| 19 |
+
TEXT_CHANGED=$(git diff --name-only --diff-filter=ACMR "$REMOTE/main" main \
|
| 20 |
+
| grep -vE "$BINARY_EXT" || true)
|
| 21 |
+
|
| 22 |
+
TEXT_DELETED=$(git diff --name-only --diff-filter=D "$REMOTE/main" main \
|
| 23 |
+
| grep -vE "$BINARY_EXT" || true)
|
| 24 |
+
|
| 25 |
+
if [ -z "$TEXT_CHANGED" ] && [ -z "$TEXT_DELETED" ]; then
|
| 26 |
+
echo "✅ Nothing to sync — HF is already up to date."
|
| 27 |
+
exit 0
|
| 28 |
+
fi
|
| 29 |
+
|
| 30 |
+
# Commit count and log (best-effort; histories may diverge)
|
| 31 |
+
COMMIT_COUNT=$(git rev-list --count "$REMOTE/main..main" 2>/dev/null || echo "?")
|
| 32 |
+
COMMIT_LOG=$(git log --oneline "$REMOTE/main..main" 2>/dev/null | head -10 \
|
| 33 |
+
|| echo "(divergent history — see origin/main)")
|
| 34 |
+
|
| 35 |
+
echo "→ Syncing ~${COMMIT_COUNT} commit(s)…"
|
| 36 |
+
[ -n "$TEXT_CHANGED" ] && echo "$TEXT_CHANGED" | sed 's/^/ + /'
|
| 37 |
+
[ -n "$TEXT_DELETED" ] && echo "$TEXT_DELETED" | sed 's/^/ - /'
|
| 38 |
+
|
| 39 |
+
# Build on top of HF's current tip (keeps HF history binary-free)
|
| 40 |
+
git checkout -b "$DEPLOY_BRANCH" "$REMOTE/main"
|
| 41 |
+
|
| 42 |
+
if [ -n "$TEXT_CHANGED" ]; then
|
| 43 |
+
while IFS= read -r f; do
|
| 44 |
+
[ -n "$f" ] && git checkout main -- "$f"
|
| 45 |
+
done <<< "$TEXT_CHANGED"
|
| 46 |
+
fi
|
| 47 |
+
|
| 48 |
+
if [ -n "$TEXT_DELETED" ]; then
|
| 49 |
+
while IFS= read -r f; do
|
| 50 |
+
[ -n "$f" ] && git rm --quiet -f -- "$f"
|
| 51 |
+
done <<< "$TEXT_DELETED"
|
| 52 |
+
fi
|
| 53 |
+
|
| 54 |
+
# Guard: nothing staged after filtering (e.g. only binary changes)
|
| 55 |
+
if git diff --cached --quiet; then
|
| 56 |
+
echo "✅ Nothing to commit after binary filtering — HF already has these changes."
|
| 57 |
+
git checkout main
|
| 58 |
+
git branch -D "$DEPLOY_BRANCH"
|
| 59 |
+
exit 0
|
| 60 |
+
fi
|
| 61 |
+
|
| 62 |
+
COMMIT_MSG="chore: sync ${COMMIT_COUNT} commit(s) from main (text-only, binaries excluded)
|
| 63 |
+
|
| 64 |
+
${COMMIT_LOG}"
|
| 65 |
+
|
| 66 |
+
git commit -m "$COMMIT_MSG"
|
| 67 |
+
git push "$REMOTE" "${DEPLOY_BRANCH}:main"
|
| 68 |
+
|
| 69 |
+
git checkout main
|
| 70 |
+
git branch -D "$DEPLOY_BRANCH"
|
| 71 |
+
|
| 72 |
+
echo "✅ Pushed to HF — ${COMMIT_COUNT} commit(s) synced, binaries excluded."
|