kalim / scripts /deploy-space.sh
YasserHaidar
Kalim Space deploy (e803a10)
bae15d1
Raw History Blame Contribute Delete
922 Bytes
#!/usr/bin/env bash
# Deploy the current HEAD to the Hugging Face Space as ONE history-free commit,
# with binary files excluded — HF rejects plain-git binaries (docx/pdf), and the
# Space only needs code + data/processed/*.json. GitHub main is never touched.
#
# Usage: ./scripts/deploy-space.sh (expects a git remote named "space")
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
EXCLUDE=(
"Kalim Thesis for Claude.docx"
"docs/Holland_Scoring_Algorithm.pdf"
"docs/TECHNICAL_DOCUMENTATION_AR.pdf"
)
export GIT_INDEX_FILE=.git/space-deploy-index
trap 'rm -f .git/space-deploy-index' EXIT
git read-tree HEAD
git rm --cached --quiet -- "${EXCLUDE[@]}"
TREE=$(git write-tree)
COMMIT=$(git commit-tree "$TREE" -m "Kalim Space deploy ($(git rev-parse --short HEAD))")
unset GIT_INDEX_FILE
git push space +"$COMMIT":refs/heads/main
echo "Deployed $COMMIT (from $(git rev-parse --short HEAD)) to the Space."