deploy: add --direct SSH push mode (gitea push pending credentials)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jing 2026-07-17 01:31:23 +10:00
parent a148b4a543
commit 65dc0061b5

View File

@ -1,7 +1,12 @@
#!/bin/bash
# Push current main to Gitea, then pull + smoke-test on the studio Macs.
# ./scripts/deploy.sh # push + pull + remote smoke on all hosts
# ./scripts/deploy.sh # push to gitea + pull + remote smoke
# ./scripts/deploy.sh --direct # no gitea: push straight to hosts over SSH
# ./scripts/deploy.sh --no-smoke # skip the remote smoke tests
#
# --direct needs the host repos to exist with
# git config receive.denyCurrentBranch updateInstead
# (already set up on m3ultra and m1ultra).
set -euo pipefail
REPO_URL="https://gitea.partly.party/monster/MIRPAMO.git"
@ -15,20 +20,31 @@ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
RUN_SMOKE=1
[[ "${1:-}" == "--no-smoke" ]] && RUN_SMOKE=0
DIRECT=0
for arg in "$@"; do
[[ "$arg" == "--no-smoke" ]] && RUN_SMOKE=0
[[ "$arg" == "--direct" ]] && DIRECT=1
done
echo "== pushing to $REPO_URL"
git push origin main
if [[ $DIRECT == 0 ]]; then
echo "== pushing to $REPO_URL"
git push origin main
fi
for HOST in "${HOSTS[@]}"; do
echo
echo "== $HOST: pull"
ssh -o ConnectTimeout=10 "$HOST" "
if [ -d $REMOTE_PATH/.git ]; then
git -C $REMOTE_PATH pull --ff-only
else
git clone $REPO_URL $REMOTE_PATH
fi"
if [[ $DIRECT == 1 ]]; then
echo "== $HOST: direct push"
git push "ssh://$HOST/Users/${HOST%%@*}/Documents/MIRPAMO" main
else
echo "== $HOST: pull"
ssh -o ConnectTimeout=10 "$HOST" "
if [ -d $REMOTE_PATH/.git ]; then
git -C $REMOTE_PATH pull --ff-only origin main
else
git clone $REPO_URL $REMOTE_PATH
fi"
fi
if [[ $RUN_SMOKE == 1 ]]; then
echo "== $HOST: smoke test"
ssh "$HOST" "cd $REMOTE_PATH && ./bin/mirpamo smoke" \