#!/bin/bash # Push current main to Gitea, then pull + smoke-test on the studio Macs. # ./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" REMOTE_PATH="~/Documents/MIRPAMO" HOSTS=( "m3ultra@100.89.131.57" "johnking@100.91.239.7" ) ROOT="$(cd "$(dirname "$0")/.." && pwd)" cd "$ROOT" RUN_SMOKE=1 DIRECT=0 for arg in "$@"; do [[ "$arg" == "--no-smoke" ]] && RUN_SMOKE=0 [[ "$arg" == "--direct" ]] && DIRECT=1 done if [[ $DIRECT == 0 ]]; then echo "== pushing to $REPO_URL" git push origin main fi for HOST in "${HOSTS[@]}"; do echo 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" \ && echo "== $HOST: PASS" \ || { echo "== $HOST: FAIL"; exit 1; } fi done echo echo "deploy complete"