Spaces:
Sleeping
Sleeping
File size: 1,324 Bytes
d094faf 640f1df d094faf 640f1df d094faf 5ead61d d094faf 5ead61d 640f1df d094faf | 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 35 36 | #!/usr/bin/env bash
# Push the current commit to the HF Space remote, with server/space/README.md
# overlaid at repo root (HF reads the Space's metadata frontmatter from the
# root README; the GitHub root README stays untouched).
#
# Prereq once:
# git remote add space https://huggingface.co/spaces/lanczos/graphtestbed
#
# Auth: export HF_TOKEN before running and the script will inject it into
# the push URL; otherwise git will prompt for username/password
# (user = lanczos, password = the token).
set -euo pipefail
BRANCH=$(git rev-parse --abbrev-ref HEAD)
TEMP="space-deploy-$(date +%s)"
PUSH_TARGET="space"
if [[ -n "${HF_TOKEN:-}" ]]; then
PUSH_TARGET="https://lanczos:${HF_TOKEN}@huggingface.co/spaces/lanczos/graphtestbed"
fi
trap 'git checkout "$BRANCH" >/dev/null 2>&1 || true; \
git branch -D "$TEMP" >/dev/null 2>&1 || true' EXIT
git checkout -b "$TEMP"
# HF Docker SDK looks for Dockerfile at the repo root; our canonical copy
# lives in server/space/. Overlay both for the deploy.
cp server/space/README.md README.md
cp server/space/Dockerfile Dockerfile
git add README.md Dockerfile
git commit --no-verify -m "deploy: overlay server/space/{README,Dockerfile} at root"
git push -f "$PUSH_TARGET" "$TEMP:main"
echo
echo "pushed to space/main"
echo "URL: https://lanczos-graphtestbed.hf.space/"
|