#!/usr/bin/env bash # Push this repo to its Hugging Face Space with the right exclusions. # # Typing the exclude list by hand every time is how node_modules ends up in a # Space repo, and how a local .env full of tokens ends up public. This keeps # both impossible. set -euo pipefail SPACE=${1:-${HF_SPACE:-}} if [ -z "$SPACE" ]; then echo "usage: scripts/push-space.sh /" echo " or: HF_SPACE=/ scripts/push-space.sh" exit 1 fi echo "Pushing to https://huggingface.co/spaces/$SPACE" hf upload "$SPACE" . --repo-type space \ --exclude \ "node_modules/**" \ ".next/**" \ ".git/**" \ "*.tsbuildinfo" \ "next-env.d.ts" \ ".env" \ ".env.local" \ ".DS_Store" \ "**/.DS_Store" echo echo "Watch the build: hf spaces logs $SPACE --build --follow" echo "Then the runtime: hf spaces logs $SPACE --follow"