Download scripts/deploy-hf.sh from NAP1320/RotNot: direct link, hf CLI and curl.
- Browser
- Download file 1.27 kB
-
https://huggingface.co/spaces/NAP1320/RotNot/resolve/main/scripts/deploy-hf.sh
- Command line
-
hf download hf://spaces/NAP1320/RotNot/scripts/deploy-hf.sh
-
curl -L -o deploy-hf.sh https://huggingface.co/spaces/NAP1320/RotNot/resolve/main/scripts/deploy-hf.sh
1.27 kB
| # Push the current commit to a Hugging Face Docker Space. | |
| # | |
| # Usage: | |
| # export HF_TOKEN=hf_xxx # a WRITE token | |
| # scripts/deploy-hf.sh <user>/<space> | |
| # | |
| # Snapshots the current git commit, swaps in the front-matter README the Space | |
| # needs, and force-pushes it to the Space's main branch. The Space must already | |
| # exist (create it once with Docker SDK — see deploy/huggingface/DEPLOY.md). | |
| set -euo pipefail | |
| SPACE="${1:?usage: deploy-hf.sh <user>/<space>}" | |
| : "${HF_TOKEN:?set HF_TOKEN to a Hugging Face write token}" | |
| ROOT="$(git rev-parse --show-toplevel)" | |
| TMP="$(mktemp -d)" | |
| trap 'rm -rf "$TMP"' EXIT | |
| # Clean snapshot of the tracked files at HEAD (no node_modules, .next, dev.db). | |
| git -C "$ROOT" archive --format=tar HEAD | tar -x -C "$TMP" | |
| # The Space root README must carry the docker/app_port YAML front matter. | |
| cp "$ROOT/deploy/huggingface/README.md" "$TMP/README.md" | |
| cd "$TMP" | |
| git init -q | |
| git add -A | |
| git -c user.email=deploy@local -c user.name=deploy commit -qm "Deploy RotNot" | |
| git branch -M main | |
| echo "→ Pushing to https://huggingface.co/spaces/${SPACE}" | |
| git push --force "https://user:${HF_TOKEN}@huggingface.co/spaces/${SPACE}.git" main | |
| echo "✓ Pushed. The Space is building at https://huggingface.co/spaces/${SPACE}" | |