Add make push / scripts/push.sh

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
2026-10-10 15:50:31 +02:00
co-authored by Claude Sonnet 5.5
parent 4ee0f57ee5
commit 62c958022a
3 changed files with 37 additions and 2 deletions
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Push all repos to origin: the three submodules (branch sv) first, then this repo (branch main).
# The parent records the submodules' commit hashes, so they must exist on the remote before it.
#
# scripts/push.sh push everything
# scripts/push.sh --dry-run show what would be pushed (still contacts the remotes)
set -euo pipefail
cd "$(dirname "$0")/.."
DRY=()
[[ "${1:-}" == "--dry-run" ]] && DRY=(--dry-run)
# Refuse to push with uncommitted work: the parent would pin a commit that lacks it.
dirty=0
for repo in 50ohm 50ohm-contents-dl 50ohm-ansible .; do
if [[ -n "$(git -C "$repo" status --porcelain --ignore-submodules=none)" ]]; then
echo "Uncommitted changes in ${repo/#./deploy (parent)}:" >&2
git -C "$repo" status --short --ignore-submodules=none | head -5 >&2
dirty=1
fi
done
(( dirty == 0 )) || { echo "Commit first, then run again." >&2; exit 1; }
for repo in 50ohm 50ohm-contents-dl 50ohm-ansible; do
echo "== $repo (sv)"
git -C "$repo" push "${DRY[@]}" -u origin sv
done
echo "== 50ohm-deploy (main)"
git push "${DRY[@]}" -u origin main