Skip to content

Commit bdde6f0

Browse files
authored
Merge pull request #288 from maxmind/greg/eng-3512
Add branch validation checks to release script
2 parents 9e455f5 + a712381 commit bdde6f0

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

dev-bin/release.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
set -eu -o pipefail
44

5+
# Check that we're not on the main branch
6+
current_branch=$(git branch --show-current)
7+
if [ "$current_branch" = "main" ]; then
8+
echo "Error: Releases should not be done directly on the main branch."
9+
echo "Please create a release branch and run this script from there."
10+
exit 1
11+
fi
12+
13+
# Fetch latest changes and check that we're not behind origin/main
14+
echo "Fetching from origin..."
15+
git fetch origin
16+
17+
if ! git merge-base --is-ancestor origin/main HEAD; then
18+
echo "Error: Current branch is behind origin/main."
19+
echo "Please merge or rebase with origin/main before releasing."
20+
exit 1
21+
fi
22+
523
changelog=$(cat HISTORY.rst)
624

725
regex='

0 commit comments

Comments
 (0)