@@ -70,6 +70,8 @@ echo "$notes"
7070
7171pecl package
7272
73+ package=" maxminddb-$version .tgz"
74+
7375read -p " Push to origin? (y/n) " should_push
7476
7577if [ " $should_push " != " y" ]; then
@@ -83,4 +85,133 @@ git push
8385
8486gh release create --target " $( git branch --show-current) " -t " $version " -n " $notes " " $tag "
8587
86- echo " Upload PECL package to pecl.php.net!"
88+ # =============================================================================
89+ # EXTENSION REPOSITORY RELEASE AUTOMATION
90+ # =============================================================================
91+
92+ ext_repo_dir=" .ext"
93+ ext_repo_url=
" [email protected] :maxmind/MaxMind-DB-Reader-php-ext.git" 94+
95+ echo " "
96+ echo " ==================================================================="
97+ echo " UPDATING EXTENSION REPOSITORY"
98+ echo " ==================================================================="
99+
100+ # Check if extension repository exists locally
101+ if [ ! -d " $ext_repo_dir " ]; then
102+ echo " Extension repository not found at: $ext_repo_dir "
103+ echo " Cloning extension repository..."
104+ git clone --recurse-submodules " $ext_repo_url " " $ext_repo_dir "
105+
106+ if [ $? -ne 0 ]; then
107+ echo " ERROR: Failed to clone extension repository"
108+ echo " Please clone manually: git clone --recurse-submodules $ext_repo_url $ext_repo_dir "
109+ exit 1
110+ fi
111+ fi
112+
113+ # Navigate to extension repository
114+ pushd " $ext_repo_dir " > /dev/null
115+
116+ # Safety check: ensure working directory is clean
117+ if [ -n " $( git status --porcelain) " ]; then
118+ echo " ERROR: Extension repository has uncommitted changes"
119+ echo " Please commit or stash changes in: $ext_repo_dir "
120+ popd > /dev/null
121+ exit 1
122+ fi
123+
124+ # Ensure we're on main branch
125+ current_branch=$( git rev-parse --abbrev-ref HEAD)
126+ if [ " $current_branch " != " main" ]; then
127+ echo " Switching to main branch..."
128+ git checkout main
129+ fi
130+
131+ # Pull latest changes
132+ echo " Pulling latest changes from origin..."
133+ git pull origin main
134+
135+ # Update submodule to the new tag
136+ echo " Updating submodule to $tag ..."
137+ cd MaxMind-DB-Reader-php
138+ git fetch --tags origin
139+ git checkout " $tag "
140+
141+ if [ $? -ne 0 ]; then
142+ echo " ERROR: Failed to checkout tag $tag in submodule"
143+ popd > /dev/null
144+ exit 1
145+ fi
146+
147+ cd ..
148+
149+ # Stage submodule update
150+ git add MaxMind-DB-Reader-php
151+
152+ # Check if there are actual changes
153+ if [ -z " $( git status --porcelain) " ]; then
154+ echo " No changes needed in extension repository (already at $tag )"
155+ popd > /dev/null
156+ echo " Extension repository is up to date"
157+ else
158+ # Commit submodule update
159+ echo " Committing submodule update..."
160+ git commit -m " Update to MaxMind-DB-Reader-php $version
161+
162+ This updates the submodule reference to track the $tag release.
163+
164+ Release notes from main repository:
165+ $notes "
166+
167+ # Push changes
168+ echo " Pushing to origin..."
169+ git push origin main
170+
171+ if [ $? -ne 0 ]; then
172+ echo " ERROR: Failed to push to extension repository"
173+ popd > /dev/null
174+ exit 1
175+ fi
176+
177+ # Create corresponding release in extension repo with same tag
178+ echo " Creating release $tag in extension repository..."
179+ gh release create " $tag " \
180+ --repo maxmind/MaxMind-DB-Reader-php-ext \
181+ --title " $version " \
182+ --notes " Extension release for MaxMind-DB-Reader-php $version
183+
184+ This release tracks the $tag tag of the main repository.
185+
186+ ## Release notes from main repository
187+
188+ $notes "
189+
190+ if [ $? -ne 0 ]; then
191+ echo " ERROR: Failed to create release in extension repository"
192+ echo " You may need to create it manually at:"
193+ echo " https://github.com/maxmind/MaxMind-DB-Reader-php-ext/releases/new?tag=$tag "
194+ popd > /dev/null
195+ exit 1
196+ fi
197+
198+ echo " "
199+ echo " ✓ Extension repository updated successfully!"
200+ echo " ✓ Release created: https://github.com/maxmind/MaxMind-DB-Reader-php-ext/releases/tag/$tag "
201+ fi
202+
203+ popd > /dev/null
204+
205+ echo " "
206+ echo " ==================================================================="
207+ echo " RELEASE COMPLETE"
208+ echo " ==================================================================="
209+ echo " "
210+ echo " Main repository: https://github.com/maxmind/MaxMind-DB-Reader-php/releases/tag/$tag "
211+ echo " Extension repository: https://github.com/maxmind/MaxMind-DB-Reader-php-ext/releases/tag/$tag "
212+ echo " "
213+ echo " Action items:"
214+ echo " 1. Upload PECL package to pecl.php.net: https://pecl.php.net/package-new.php"
215+ echo " File: $package "
216+ echo " 2. Verify PIE installation: pie install maxmind-db/reader-ext:^$version "
217+ echo " 3. Announce release"
0 commit comments