Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,30 @@ if [[ ! $1 =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]
exit 1
fi

git checkout main
git pull
# Pre-flight checks
if [[ "$(git branch --show-current)" != "main" ]]; then
echo "You must be on the main branch to release." >&2
exit 1
fi

if [[ -n "$(git status --porcelain)" ]]; then
echo "Working tree is not clean. Commit or stash your changes first." >&2
exit 1
fi

git fetch origin
local_head="$(git rev-parse HEAD)"
remote_head="$(git rev-parse origin/main)"
if [[ "$local_head" != "$remote_head" ]]; then
if git merge-base --is-ancestor HEAD origin/main; then
echo "Local main is behind origin/main. Pull first." >&2
elif git merge-base --is-ancestor origin/main HEAD; then
echo "Local main is ahead of origin/main. Push your commits or reset to origin/main before releasing." >&2
else
echo "Local main has diverged from origin/main. Reconcile with pull/rebase/reset before releasing." >&2
fi
exit 1
fi

Comment on lines +49 to 62
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script now hardcodes origin/main (both in git fetch origin and in the comparison). This is a behavioral regression vs git pull because it will fail for clones that don't have a remote named origin or where main tracks a different upstream. Consider deriving the upstream ref from main’s configured tracking branch (e.g., @{u}) and fetching that, or emitting a clear error if no upstream is configured.

Suggested change
git fetch origin
if [[ -n "$(git diff HEAD origin/main)" ]]; then
echo "Local main is not up to date with origin/main. Pull first." >&2
exit 1
fi
upstream_ref="$(git rev-parse --abbrev-ref --symbolic-full-name '@{u}' 2>/dev/null || true)"
if [[ -z "${upstream_ref}" ]]; then
echo "The main branch has no configured upstream. Configure a tracking branch first." >&2
exit 1
fi
upstream_remote="${upstream_ref%%/*}"
git fetch "${upstream_remote}"
if [[ -n "$(git diff HEAD "${upstream_ref}")" ]]; then
echo "Local main is not up to date with ${upstream_ref}. Pull first." >&2
exit 1
fi

Copilot uses AI. Check for mistakes.
cd caddy/
go get "github.com/dunglas/frankenphp@v$1"
Expand Down
Loading