Skip to content

Commit cdff74e

Browse files
committed
Add pre-packaged source tarball for PIE
PIE doesn't handle git submodules because it downloads ZIP archives. To work around this, create a pre-packaged source tarball that includes the submodule contents: - Create php_maxminddb-{version}-src.tgz from submodule ext/ directory - Upload as GitHub release asset - PIE automatically detects and uses this instead of ZIP - Same approach used by MongoDB extension References: - php/pie#39
1 parent 8bdc66f commit cdff74e

File tree

2 files changed

+64
-2
lines changed

2 files changed

+64
-2
lines changed

dev-bin/release.sh

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,24 @@ $notes"
174174
exit 1
175175
fi
176176

177+
# Create pre-packaged source tarball for PIE
178+
# PIE needs this because it doesn't handle git submodules automatically
179+
echo "Creating pre-packaged source tarball for PIE..."
180+
pie_tarball="php_maxminddb-${version}-src.tgz"
181+
182+
# Create tarball from the ext directory in the submodule
183+
tar -czf "$pie_tarball" \
184+
--transform "s|^MaxMind-DB-Reader-php/ext|php_maxminddb-${version}|" \
185+
MaxMind-DB-Reader-php/ext/
186+
187+
if [ $? -ne 0 ]; then
188+
echo "ERROR: Failed to create source tarball"
189+
popd > /dev/null
190+
exit 1
191+
fi
192+
193+
echo "Created $pie_tarball"
194+
177195
# Create corresponding release in extension repo with same tag
178196
echo "Creating release $tag in extension repository..."
179197
gh release create "$tag" \
@@ -185,7 +203,8 @@ This release tracks the $tag tag of the main repository.
185203
186204
## Release notes from main repository
187205
188-
$notes"
206+
$notes" \
207+
"$pie_tarball"
189208

190209
if [ $? -ne 0 ]; then
191210
echo "ERROR: Failed to create release in extension repository"
@@ -195,9 +214,13 @@ $notes"
195214
exit 1
196215
fi
197216

217+
# Clean up tarball
218+
rm -f "$pie_tarball"
219+
198220
echo ""
199221
echo "✓ Extension repository updated successfully!"
200222
echo "✓ Release created: https://github.com/maxmind/MaxMind-DB-Reader-php-ext/releases/tag/$tag"
223+
echo "✓ Pre-packaged source uploaded: $pie_tarball"
201224
fi
202225

203226
popd > /dev/null

plan.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@
33
## Overview
44
Set up a new extension repository (`MaxMind-DB-Reader-php-ext`) that uses this repo as a submodule, and automate releases via `dev-bin/release.sh`.
55

6+
## PIE and Submodules
7+
8+
PIE downloads source code as ZIP archives from Composer/GitHub, which don't include git submodule contents. To work around this limitation, we use PIE's built-in support for **pre-packaged source archives**:
9+
10+
- The release script creates a tarball: `php_maxminddb-{version}-src.tgz`
11+
- This tarball includes the full ext/ directory from the submodule
12+
- It's uploaded as a GitHub release asset
13+
- PIE automatically detects and uses this pre-packaged source instead of the ZIP archive
14+
15+
This is the same approach used by the MongoDB extension and others with submodule dependencies. See:
16+
- https://github.com/php/pie/issues/39
17+
- MongoDB extension implementation
18+
619
## Phase 1: Create Extension Repository Structure
720

821
### 1.1 Create new repository at github.com/maxmind/MaxMind-DB-Reader-php-ext
@@ -219,6 +232,24 @@ $notes"
219232
exit 1
220233
fi
221234

235+
# Create pre-packaged source tarball for PIE
236+
# PIE needs this because it doesn't handle git submodules automatically
237+
echo "Creating pre-packaged source tarball for PIE..."
238+
pie_tarball="php_maxminddb-${version}-src.tgz"
239+
240+
# Create tarball from the ext directory in the submodule
241+
tar -czf "$pie_tarball" \
242+
--transform "s|^MaxMind-DB-Reader-php/ext|php_maxminddb-${version}|" \
243+
MaxMind-DB-Reader-php/ext/
244+
245+
if [ $? -ne 0 ]; then
246+
echo "ERROR: Failed to create source tarball"
247+
popd > /dev/null
248+
exit 1
249+
fi
250+
251+
echo "Created $pie_tarball"
252+
222253
# Create corresponding release in extension repo with same tag
223254
echo "Creating release $tag in extension repository..."
224255
gh release create "$tag" \
@@ -230,7 +261,8 @@ This release tracks the $tag tag of the main repository.
230261
231262
## Release notes from main repository
232263
233-
$notes"
264+
$notes" \
265+
"$pie_tarball"
234266

235267
if [ $? -ne 0 ]; then
236268
echo "ERROR: Failed to create release in extension repository"
@@ -240,9 +272,13 @@ $notes"
240272
exit 1
241273
fi
242274

275+
# Clean up tarball
276+
rm -f "$pie_tarball"
277+
243278
echo ""
244279
echo "✓ Extension repository updated successfully!"
245280
echo "✓ Release created: https://github.com/maxmind/MaxMind-DB-Reader-php-ext/releases/tag/$tag"
281+
echo "✓ Pre-packaged source uploaded: $pie_tarball"
246282
fi
247283

248284
popd > /dev/null
@@ -268,6 +304,9 @@ echo "3. Announce release"
268304
- Ensures on main branch
269305
- Verifies tag checkout succeeds
270306
- Only commits if there are changes
307+
- Creates pre-packaged source tarball with naming convention: `php_maxminddb-{version}-src.tgz`
308+
- Uploads tarball as GitHub release asset for PIE
309+
- Cleans up tarball after upload
271310
- Handles push/release failures gracefully
272311

273312
## Phase 3: Update Main Repository Documentation

0 commit comments

Comments
 (0)