Spaces:
Running
Running
Zhu Jiajun (jz28583) Claude Opus 4.7 (1M context) commited on
Commit ·
640f1df
1
Parent(s): cf612db
push_to_space.sh: auto-inject HF_TOKEN into push URL when set
Browse filesCo-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
server/space/push_to_space.sh
CHANGED
|
@@ -6,14 +6,19 @@
|
|
| 6 |
# Prereq once:
|
| 7 |
# git remote add space https://huggingface.co/spaces/lanczos/graphtestbed
|
| 8 |
#
|
| 9 |
-
#
|
| 10 |
-
#
|
| 11 |
-
#
|
| 12 |
set -euo pipefail
|
| 13 |
|
| 14 |
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
| 15 |
TEMP="space-deploy-$(date +%s)"
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
trap 'git checkout "$BRANCH" >/dev/null 2>&1 || true; \
|
| 18 |
git branch -D "$TEMP" >/dev/null 2>&1 || true' EXIT
|
| 19 |
|
|
@@ -24,7 +29,7 @@ cp server/space/README.md README.md
|
|
| 24 |
cp server/space/Dockerfile Dockerfile
|
| 25 |
git add README.md Dockerfile
|
| 26 |
git commit --no-verify -m "deploy: overlay server/space/{README,Dockerfile} at root"
|
| 27 |
-
git push -f
|
| 28 |
echo
|
| 29 |
echo "pushed to space/main"
|
| 30 |
echo "URL: https://lanczos-graphtestbed.hf.space/"
|
|
|
|
| 6 |
# Prereq once:
|
| 7 |
# git remote add space https://huggingface.co/spaces/lanczos/graphtestbed
|
| 8 |
#
|
| 9 |
+
# Auth: export HF_TOKEN before running and the script will inject it into
|
| 10 |
+
# the push URL; otherwise git will prompt for username/password
|
| 11 |
+
# (user = lanczos, password = the token).
|
| 12 |
set -euo pipefail
|
| 13 |
|
| 14 |
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
| 15 |
TEMP="space-deploy-$(date +%s)"
|
| 16 |
|
| 17 |
+
PUSH_TARGET="space"
|
| 18 |
+
if [[ -n "${HF_TOKEN:-}" ]]; then
|
| 19 |
+
PUSH_TARGET="https://lanczos:${HF_TOKEN}@huggingface.co/spaces/lanczos/graphtestbed"
|
| 20 |
+
fi
|
| 21 |
+
|
| 22 |
trap 'git checkout "$BRANCH" >/dev/null 2>&1 || true; \
|
| 23 |
git branch -D "$TEMP" >/dev/null 2>&1 || true' EXIT
|
| 24 |
|
|
|
|
| 29 |
cp server/space/Dockerfile Dockerfile
|
| 30 |
git add README.md Dockerfile
|
| 31 |
git commit --no-verify -m "deploy: overlay server/space/{README,Dockerfile} at root"
|
| 32 |
+
git push -f "$PUSH_TARGET" "$TEMP:main"
|
| 33 |
echo
|
| 34 |
echo "pushed to space/main"
|
| 35 |
echo "URL: https://lanczos-graphtestbed.hf.space/"
|