#!/usr/bin/env sh # Push this folder to the Hugging Face Space. The Space rebuilds its image and restarts. # # ./deploy.sh deploy with the engine commit already written in the Dockerfile # ./deploy.sh pin the engine to that commit of mertkayacs/postkitty, then deploy # # Needs the `hf` CLI, logged in with write access to the Space. set -eu cd "$(dirname "$0")" SPACE="${POSTKITTY_SPACE:-mertkayacs/postkitty-api}" if [ -n "${1:-}" ]; then sed -i "s/^ARG POSTKITTY_REF=.*/ARG POSTKITTY_REF=$1/" Dockerfile fi ref=$(sed -n 's/^ARG POSTKITTY_REF=//p' Dockerfile) hf upload "$SPACE" . . --type space \ --exclude ".venv/*" --exclude ".engine/*" --exclude ".pytest-tmp/*" --exclude ".pytest_cache/*" \ --exclude "*__pycache__*" \ --delete "*" \ --commit-message "deploy with engine ${ref}" echo "Pushed. Watch the build: hf spaces logs $SPACE --build" echo "Then check: curl https://$(echo "$SPACE" | tr '/' '-').hf.space/v1/health"