File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -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]
3535 exit 1
3636fi
3737
38- git checkout main
39- git pull
38+ # Pre-flight checks
39+ if [[ " $( git branch --show-current) " != " main" ]]; then
40+ echo " You must be on the main branch to release." >&2
41+ exit 1
42+ fi
43+
44+ if [[ -n " $( git status --porcelain) " ]]; then
45+ echo " Working tree is not clean. Commit or stash your changes first." >&2
46+ exit 1
47+ fi
48+
49+ git fetch origin
50+ local_head=" $( git rev-parse HEAD) "
51+ remote_head=" $( git rev-parse origin/main) "
52+ if [[ " $local_head " != " $remote_head " ]]; then
53+ if git merge-base --is-ancestor HEAD origin/main; then
54+ echo " Local main is behind origin/main. Pull first." >&2
55+ elif git merge-base --is-ancestor origin/main HEAD; then
56+ echo " Local main is ahead of origin/main. Push your commits or reset to origin/main before releasing." >&2
57+ else
58+ echo " Local main has diverged from origin/main. Reconcile with pull/rebase/reset before releasing." >&2
59+ fi
60+ exit 1
61+ fi
4062
4163cd caddy/
4264go get " github.com/dunglas/frankenphp@v$1 "
You can’t perform that action at this time.
0 commit comments