@@ -6,26 +6,26 @@ set -eu -o pipefail
66# before making any changes to the repository
77
88check_command () {
9- if ! command -v " $1 " & > /dev/null; then
9+ if ! command -v " $1 " & > /dev/null; then
1010 echo " Error: $1 is not installed or not in PATH"
1111 exit 1
1212 fi
1313}
1414
1515# Verify gh CLI is authenticated
16- if ! gh auth status & > /dev/null; then
16+ if ! gh auth status & > /dev/null; then
1717 echo " Error: gh CLI is not authenticated. Run 'gh auth login' first."
1818 exit 1
1919fi
2020
2121# Verify we can access this repository via gh
22- if ! gh repo view --json name & > /dev/null; then
22+ if ! gh repo view --json name & > /dev/null; then
2323 echo " Error: Cannot access repository via gh. Check your authentication and repository access."
2424 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
28+ if ! git ls-remote origin & > /dev/null; then
2929 echo " Error: Cannot connect to git remote. Check your git credentials/SSH keys."
3030 exit 1
3131fi
5656changelog=$( cat CHANGELOG.md)
5757
5858regex='
59- ([0-9]+\.[0-9]+\.[0-9]+) \(([0-9]{4}-[0-9]{2}-[0-9]{2})\)
59+ ([0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)? ) \(([0-9]{4}-[0-9]{2}-[0-9]{2})\)
6060-*
6161
6262((.|
6363)*)
6464'
6565
6666if [[ ! $changelog =~ $regex ]]; then
67- echo " Could not find date line in change log!"
68- exit 1
67+ echo " Could not find date line in change log!"
68+ exit 1
6969fi
7070
7171version=" ${BASH_REMATCH[1]} "
72- date=" ${BASH_REMATCH[2 ]} "
73- notes=" $( echo " ${BASH_REMATCH[3 ]} " | sed -n -e ' /^[0-9]\ +\.[0-9]\ +\.[0-9]\+ /,$!p' ) "
72+ date=" ${BASH_REMATCH[3 ]} "
73+ notes=" $( echo " ${BASH_REMATCH[4 ]} " | sed -n -E ' /^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)? /,$!p' ) "
7474
75- if [[ " $date " != $( date +" %Y-%m-%d" ) ]]; then
75+ if [[ " $date " != " $( date +" %Y-%m-%d" ) " ]]; then
7676 echo " $date is not today!"
7777 exit 1
7878fi
@@ -120,7 +120,7 @@ pecl package
120120
121121package=" maxminddb-$version .tgz"
122122
123- read -p " Push to origin? (y/n) " should_push
123+ read -r - p " Push to origin? (y/n) " should_push
124124
125125if [ " $should_push " != " y" ]; then
126126 echo " Aborting"
@@ -159,13 +159,13 @@ if [ ! -d "$ext_repo_dir" ]; then
159159fi
160160
161161# Navigate to extension repository
162- pushd " $ext_repo_dir " > /dev/null
162+ pushd " $ext_repo_dir " > /dev/null
163163
164164# Safety check: ensure working directory is clean
165165if [ -n " $( git status --porcelain) " ]; then
166166 echo " ERROR: Extension repository has uncommitted changes"
167167 echo " Please commit or stash changes in: $ext_repo_dir "
168- popd > /dev/null
168+ popd > /dev/null
169169 exit 1
170170fi
171171
@@ -188,7 +188,7 @@ git checkout "$tag"
188188
189189if [ $? -ne 0 ]; then
190190 echo " ERROR: Failed to checkout tag $tag in submodule"
191- popd > /dev/null
191+ popd > /dev/null
192192 exit 1
193193fi
194194
@@ -200,7 +200,7 @@ git add MaxMind-DB-Reader-php
200200# Check if there are actual changes
201201if [ -z " $( git status --porcelain) " ]; then
202202 echo " No changes needed in extension repository (already at $tag )"
203- popd > /dev/null
203+ popd > /dev/null
204204 echo " Extension repository is up to date"
205205else
206206 # Commit submodule update
@@ -218,7 +218,7 @@ $notes"
218218
219219 if [ $? -ne 0 ]; then
220220 echo " ERROR: Failed to push to extension repository"
221- popd > /dev/null
221+ popd > /dev/null
222222 exit 1
223223 fi
224224
@@ -229,13 +229,13 @@ $notes"
229229
230230 # Create tarball with files at root level (PIE requirement)
231231 # Note: naming must be {extension-name}-v{version}.tgz
232- pushd MaxMind-DB-Reader-php/ext > /dev/null
232+ pushd MaxMind-DB-Reader-php/ext > /dev/null
233233 tar -czf " ../../$pie_tarball " *
234- popd > /dev/null
234+ popd > /dev/null
235235
236236 if [ ! -f " $pie_tarball " ]; then
237237 echo " ERROR: Failed to create source tarball"
238- popd > /dev/null
238+ popd > /dev/null
239239 exit 1
240240 fi
241241
@@ -259,7 +259,7 @@ $notes" \
259259 echo " ERROR: Failed to create release in extension repository"
260260 echo " You may need to create it manually at:"
261261 echo " https://github.com/maxmind/MaxMind-DB-Reader-php-ext/releases/new?tag=$tag "
262- popd > /dev/null
262+ popd > /dev/null
263263 exit 1
264264 fi
265265
@@ -272,7 +272,7 @@ $notes" \
272272 echo " ✓ Pre-packaged source uploaded: $pie_tarball "
273273fi
274274
275- popd > /dev/null
275+ popd > /dev/null
276276
277277echo " "
278278echo " ==================================================================="
0 commit comments