Skip to content

armgit / muxin

Public Imported from GitHub
0

All your machines, one app. For you and your AI agents: agent sessions, desktops, files, logs and GitHub across your Macs, Linux and Windows machines, with an MCP server.

release.sh: move main up too when releasing from a branch main follows

Adib Hanna8aaffde42f5d
diff --git a/RELEASING.md b/RELEASING.md
index 21cbb0b..b7e8b96 100644
--- a/RELEASING.md
+++ b/RELEASING.md
@@ -26,6 +26,10 @@ The script sets the version in `Cargo.toml` and `Cargo.lock`, commits it, tags
the commit `v0.2.0` and pushes both. Leave out `--push` to look first; then
`git push origin HEAD v0.2.0`.
+You can also run it on a branch that `main` follows, like `muxen`. Then `--push`
+moves `main` up to it too, here and on GitHub. If `main` has commits the branch
+doesn't, it stays where it is and the script says so.
+
Then:
```sh
diff --git a/scripts/release.sh b/scripts/release.sh
index fcda253..90bb2ac 100755
--- a/scripts/release.sh
+++ b/scripts/release.sh
@@ -6,6 +6,9 @@
# scripts/release.sh 0.2.0 # commit and tag here; push yourself
# scripts/release.sh 0.2.0 --push # and push the branch and the tag
#
+# Run on another branch that main follows (like muxen), --push moves main up to
+# it too, here and on GitHub, when main can fast-forward.
+#
# See RELEASING.md.
set -eu
@@ -42,7 +45,23 @@ git tag -a "v$version" -m "Muxen $version"
echo "▸ tagged v$version on $(git rev-parse --short HEAD)"
if [ -n "$push" ]; then
- git push --quiet origin HEAD "v$version"
+ branch=$(git branch --show-current)
+ main=
+ if [ -n "$branch" ] && [ "$branch" != main ]; then
+ git fetch --quiet origin main
+ if git merge-base --is-ancestor origin/main HEAD && git merge-base --is-ancestor main HEAD 2>/dev/null; then
+ main=1
+ else
+ echo "note: main can't fast-forward to $branch, so it stays where it is" >&2
+ fi
+ fi
+ if [ -n "$main" ]; then
+ git push --quiet origin HEAD HEAD:main "v$version"
+ git branch --force main HEAD
+ echo "▸ main moved up to $branch"
+ else
+ git push --quiet origin HEAD "v$version"
+ fi
echo "▸ pushed: the release workflow is building it (gh run watch, or Actions on GitHub)"
else
echo "Push it to build the release: git push origin HEAD v$version"