Spaces:
Sleeping
Sleeping
Download scripts/deploy.sh from marvit0/raaf-alpha: direct link, hf CLI and curl.
- Browser
- Download file 1.77 kB
-
https://huggingface.co/spaces/marvit0/raaf-alpha/resolve/main/scripts/deploy.sh
- Command line
-
hf download hf://spaces/marvit0/raaf-alpha/scripts/deploy.sh
-
curl -L -o deploy.sh https://huggingface.co/spaces/marvit0/raaf-alpha/resolve/main/scripts/deploy.sh
1.77 kB
| set -euo pipefail | |
| # ββββββββββββββββββββββββββββββββββββββββββββββ | |
| # scripts/deploy.sh | |
| # One-step βcleanβ deploy to Hugging Face Spaces. | |
| # This will completely replace the remote history. | |
| # Usage: ./scripts/deploy.sh | |
| # Requires .env at project root with: | |
| # OPENAI_API_KEY= | |
| # HF_USER= | |
| # HF_SPACE= | |
| # HF_TOKEN= | |
| # ββββββββββββββββββββββββββββββββββββββββββββββ | |
| REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | |
| DEPLOY_DIR="$REPO_ROOT/hf_space" | |
| # 1) Load environment variables | |
| if [[ -f "$REPO_ROOT/.env" ]]; then | |
| set -o allexport | |
| source "$REPO_ROOT/.env" | |
| set +o allexport | |
| else | |
| echo "β .env file not found at $REPO_ROOT/.env" | |
| exit 1 | |
| fi | |
| # 2) Authenticate | |
| echo "π Logging in to Hugging Face..." | |
| huggingface-cli login --token "$HF_TOKEN" | |
| # 3) Wipe any existing local clone | |
| echo "π§Ή Removing old hf_space/ (if any)..." | |
| rm -rf "$DEPLOY_DIR" | |
| # 4) Create fresh directory & init git | |
| echo "π Creating fresh Git repo in hf_space/..." | |
| mkdir -p "$DEPLOY_DIR" | |
| cd "$DEPLOY_DIR" | |
| git init | |
| git remote add origin "https://huggingface.co/spaces/${HF_USER}/${HF_SPACE}.git" | |
| git checkout -b main | |
| # 5) Sync your code (excluding .env and .git) | |
| echo "π Syncing code into hf_space/..." | |
| rsync -av --delete \ | |
| --exclude '.git/' \ | |
| --exclude '.env' \ | |
| "$REPO_ROOT"/ "$DEPLOY_DIR"/ | |
| # 6) Commit & force-push as a single βcleanβ commit | |
| echo "πΎ Committing and pushing to remote (force)..." | |
| git add . | |
| git commit -m "Clean deploy: $(date +%Y-%m-%dT%H:%M:%S)" | |
| git push origin main --force | |
| echo "π Done! Your Space has been reset and updated." | |