@@ -6,28 +6,28 @@ set -eu -o pipefail
66# before making any changes to the repository
77
88check_command () {
9- if ! command -v " $1 " & > /dev/null; then
10- echo " Error: $1 is not installed or not in PATH"
11- exit 1
12- fi
9+ if ! command -v " $1 " & > /dev/null; then
10+ echo " Error: $1 is not installed or not in PATH"
11+ exit 1
12+ fi
1313}
1414
1515# Verify gh CLI is authenticated
16- if ! gh auth status & > /dev/null; then
17- echo " Error: gh CLI is not authenticated. Run 'gh auth login' first."
18- exit 1
16+ if ! gh auth status & > /dev/null; then
17+ echo " Error: gh CLI is not authenticated. Run 'gh auth login' first."
18+ exit 1
1919fi
2020
2121# Verify we can access this repository via gh
22- if ! gh repo view --json name & > /dev/null; then
23- echo " Error: Cannot access repository via gh. Check your authentication and repository access."
24- exit 1
22+ if ! gh repo view --json name & > /dev/null; then
23+ echo " Error: Cannot access repository via gh. Check your authentication and repository access."
24+ exit 1
2525fi
2626
2727# Verify git can connect to the remote (catches SSH key issues, etc.)
28- if ! git ls-remote origin & > /dev/null; then
29- echo " Error: Cannot connect to git remote. Check your git credentials/SSH keys."
30- exit 1
28+ if ! git ls-remote origin & > /dev/null; then
29+ echo " Error: Cannot connect to git remote. Check your git credentials/SSH keys."
30+ exit 1
3131fi
3232
3333check_command perl
@@ -36,19 +36,19 @@ check_command rake
3636# Check that we're not on the main branch
3737current_branch=$( git branch --show-current)
3838if [ " $current_branch " = " main" ]; then
39- echo " Error: Releases should not be done directly on the main branch."
40- echo " Please create a release branch and run this script from there."
41- exit 1
39+ echo " Error: Releases should not be done directly on the main branch."
40+ echo " Please create a release branch and run this script from there."
41+ exit 1
4242fi
4343
4444# Fetch latest changes and check that we're not behind origin/main
4545echo " Fetching from origin..."
4646git fetch origin
4747
4848if ! git merge-base --is-ancestor origin/main HEAD; then
49- echo " Error: Current branch is behind origin/main."
50- echo " Please merge or rebase with origin/main before releasing."
51- exit 1
49+ echo " Error: Current branch is behind origin/main."
50+ echo " Please merge or rebase with origin/main before releasing."
51+ exit 1
5252fi
5353
5454changelog=$( cat CHANGELOG.md)
@@ -61,8 +61,8 @@ regex='
6161'
6262
6363if [[ ! $changelog =~ $regex ]]; then
64- echo " Could not find date line in change log!"
65- exit 1
64+ echo " Could not find date line in change log!"
65+ exit 1
6666fi
6767
6868version=" ${BASH_REMATCH[1]} "
@@ -71,15 +71,15 @@ notes="$(echo "${BASH_REMATCH[4]}" | sed -n -E '/^## [0-9]+\.[0-9]+\.[0-9]+(-[a-
7171
7272echo " $notes "
7373if [[ " $date " != " $( date +" %Y-%m-%d" ) " ]]; then
74- echo " $date is not today!"
75- exit 1
74+ echo " $date is not today!"
75+ exit 1
7676fi
7777
7878tag=" v$version "
7979
8080if [ -n " $( git status --porcelain) " ]; then
81- echo " . is not clean." >&2
82- exit 1
81+ echo " . is not clean." >&2
82+ exit 1
8383fi
8484
8585perl -pi -e " s/(?<=s.version\s{,20}=\s{,20}\').+?(?=\')/$version /g" maxmind-db.gemspec
@@ -94,11 +94,11 @@ git diff
9494echo $' \n Release notes:'
9595echo " $notes "
9696
97- read -e -p " Commit changes and push to origin? " should_push
97+ read -r - e -p " Commit changes and push to origin? " should_push
9898
9999if [ " $should_push " != " y" ]; then
100- echo " Aborting"
101- exit 1
100+ echo " Aborting"
101+ exit 1
102102fi
103103
104104git commit -m " Update for $tag " -a
0 commit comments