Skip to content
Open
Changes from 1 commit
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
18 changes: 16 additions & 2 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,22 @@ 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
if [[ -n "$(git diff HEAD origin/main)" ]]; then
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 up-to-date check uses git diff HEAD origin/main, which compares trees only. It can be empty even when HEAD is a different commit than origin/main (same tree, different history), causing the release tags to be created from the wrong commit. Consider verifying commit equality (e.g., compare git rev-parse HEAD vs git rev-parse origin/main, or otherwise ensure HEAD exactly matches the remote tip).

Suggested change
if [[ -n "$(git diff HEAD origin/main)" ]]; then
head_commit="$(git rev-parse HEAD)"
origin_main_commit="$(git rev-parse origin/main)"
if [[ "${head_commit}" != "${origin_main_commit}" ]]; then

Copilot uses AI. Check for mistakes.
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.

[[ -n "$(git diff HEAD origin/main)" ]] materializes the entire diff output into a shell variable, which is unnecessary and can be slow/memory-heavy on large diffs. Prefer a quiet check (e.g., git diff --quiet ...) and branch on the exit status.

Suggested change
if [[ -n "$(git diff HEAD origin/main)" ]]; then
if ! git diff --quiet HEAD origin/main; then

Copilot uses AI. Check for mistakes.
echo "Local main is not up to date with origin/main. Pull first." >&2
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