File size: 922 Bytes
bae15d1 | 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 | #!/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."
|