Spaces:
Running
Running
File size: 593 Bytes
1177cc0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #!/usr/bin/env bash
# Push HEAD to the HF Space with a GIT_SHA stamp so GET /version reports the deployed commit.
# usage: ./deploy_hf.sh (needs the `hf-seudoe` git remote)
set -euo pipefail
SHA=$(git rev-parse HEAD)
URL=$(git remote get-url hf-seudoe)
T=$(mktemp -d)
git archive HEAD | tar -x -C "$T"
echo "$SHA" > "$T/GIT_SHA"
cd "$T"
git init -q -b main
git -c user.name=ci -c user.email=ci@users.noreply.github.com add -A
git -c user.name=ci -c user.email=ci@users.noreply.github.com commit -q -m "deploy $SHA"
git push -q --force "$URL" HEAD:main
echo "deployed ${SHA:0:7} to HF Space"
|