File size: 872 Bytes
76528e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/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 <user>/<space>"
  echo "   or: HF_SPACE=<user>/<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"