Spaces:
Sleeping
Sleeping
File size: 1,451 Bytes
0cc98ef 5be0779 0cc98ef 5be0779 0cc98ef 5be0779 0cc98ef f11cc8d 5be0779 0cc98ef 5be0779 0cc98ef 5be0779 0cc98ef 5be0779 642bb52 5be0779 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | #!/bin/bash
set -euo pipefail
echo "π Deploying to Hugging Face Space..."
# Resolve paths
DEV_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
HF_ROOT="${DEV_ROOT}/../kbdebugger-demo-hf"
# Check HF repo exists
if [ ! -d "$HF_ROOT/.git" ]; then
echo "β HF repo not found at: $HF_ROOT"
echo " Clone it first:"
echo " git clone https://huggingface.co/spaces/faris-abuali/kbdebugger-demo kbdebugger-demo-hf"
exit 1
fi
# Sync files (exclude binaries and unnecessary dirs)
echo "π Syncing files..."
rsync -av --delete \
--exclude ".git/" \
--exclude "venv/" \
--exclude "__pycache__/" \
--exclude ".pytest_cache/" \
--exclude "logs/" \
--exclude ".env" \
--exclude "docs/" \
--exclude "data/" \
--exclude "notebooks/" \
--exclude "ui/static/img/" \
--exclude "README.md" \
"$DEV_ROOT/" "$HF_ROOT/"
# Commit and push
cd "$HF_ROOT"
echo "π Committing changes..."
git add -A
git commit -m "Deploy $(date -Iseconds)" || echo "No changes to commit."
echo "π€ Pushing to Hugging Face..."
# Try the safe force first (protects against overwriting unexpected remote updates)
if git push --force-with-lease; then
echo "β
Pushed with --force-with-lease."
else
echo "β οΈ --force-with-lease failed (likely remote moved and local didn't fetch)."
echo " Falling back to plain --force for deploy mirror..."
git push --force
echo "β
Pushed with --force."
fi
echo "β
Deployment complete." |