DariusGiannoli commited on
Commit
cd0d248
·
1 Parent(s): 7dac402

fix: simplify push script to normal git push

Browse files
Files changed (1) hide show
  1. push_hf.sh +8 -21
push_hf.sh CHANGED
@@ -1,27 +1,14 @@
1
  #!/bin/bash
2
- # Push current state to Hugging Face Spaces cleanly (no binary history)
3
  set -e
4
 
5
- cleanup() {
6
- git checkout main 2>/dev/null || true
7
- git branch -D hf-tmp 2>/dev/null || true
8
- }
9
-
10
- echo "→ Creating clean snapshot for HF..."
11
- git checkout --orphan hf-tmp
12
- git rm -rf --cached . > /dev/null 2>&1
13
- git add .
14
-
15
- BINARIES=$(git diff --cached --name-only | grep -E "\.(png|jpg|pt|pth)$" || true)
16
- if [ -n "$BINARIES" ]; then
17
- echo "⚠ Warning: these binaries are still staged:"
18
- echo "$BINARIES"
19
- cleanup
20
- exit 1
21
  fi
22
 
23
- git commit -m "deploy: $(date '+%Y-%m-%d %H:%M')"
24
- echo "→ Force-pushing to hf/main..."
25
- git push hf hf-tmp:main --force
26
- cleanup
27
  echo "✓ Done! Space is updating at https://huggingface.co/spaces/DariusGiannoli/PerceptionBenchmark"
 
1
  #!/bin/bash
2
+ # Push current state to Hugging Face Spaces
3
  set -e
4
 
5
+ # Auto-commit any uncommitted changes before pushing
6
+ if ! git diff --quiet || ! git diff --cached --quiet; then
7
+ echo "→ Uncommitted changes detected committing to main first..."
8
+ git add .
9
+ git commit -m "chore: auto-save before deploy $(date '+%Y-%m-%d %H:%M')"
 
 
 
 
 
 
 
 
 
 
 
10
  fi
11
 
12
+ echo " Pushing to HF Spaces..."
13
+ git push hf main --force
 
 
14
  echo "✓ Done! Space is updating at https://huggingface.co/spaces/DariusGiannoli/PerceptionBenchmark"