@@ -142,9 +142,8 @@ jobs:
142
142
### 🔄 Release Process
143
143
After merging this PR:
144
144
1. Package will be built and tested
145
- 2. Published to Test PyPI automatically
146
- 3. **Manual approval required** before production PyPI
147
- 4. GitHub release and tag created after production
145
+ 2. **Manual approval required** before publishing to PyPI
146
+ 3. GitHub release and tag created after PyPI publication
148
147
149
148
### 🚨 Running from: ${{ github.ref }}
150
149
${{ github.ref != 'refs/heads/main' && '**WARNING**: Not running from main branch!' || '✅ Running from main branch' }}
@@ -208,50 +207,28 @@ jobs:
208
207
name : dist
209
208
path : dist/
210
209
211
- publish-testpypi :
212
- name : Publish to TestPyPI
213
- needs : test-and-build
214
- runs-on : ubuntu-latest
215
- environment :
216
- name : test-pypi
217
-
218
- steps :
219
- - name : Download artifacts
220
- uses : actions/download-artifact@v5
221
- with :
222
- name : dist
223
- path : dist/
224
-
225
- - name : Publish to TestPyPI
226
- uses : pypa/gh-action-pypi-publish@release/v1
227
- with :
228
- repository-url : https://test.pypi.org/legacy/
229
- skip-existing : true
230
- password : ${{ secrets.TEST_PYPI_API_TOKEN }}
231
-
232
210
release-approval :
233
211
name : Release Approval
234
- needs : publish-testpypi
212
+ needs : test-and-build
235
213
runs-on : ubuntu-latest
236
- # IMPORTANT: Always run if test PyPI succeeded
237
- if : always() && needs.publish-testpypi.result == 'success'
238
214
environment :
239
215
name : pypi-approval
240
216
241
217
steps :
242
218
- name : Approval checkpoint
243
219
run : |
244
- echo "✅ TestPyPI deployment successful"
245
- echo "📦 Package available at: https://test.pypi.org/project/bedrock-agentcore/ "
220
+ echo "✅ Build and tests successful"
221
+ echo "📦 Package ready for PyPI publication "
246
222
echo ""
247
223
echo "⚠️ MANUAL APPROVAL REQUIRED FOR PRODUCTION"
248
224
echo ""
249
225
echo "Before approving:"
250
- echo "1. Test package: pip install -i https://test.pypi.org/simple/ bedrock-agentcore"
251
- echo "2. Verify functionality works"
252
- echo "3. Check version is correct"
226
+ echo "1. Verify the PR has been merged to main"
227
+ echo "2. Check that version number is correct"
228
+ echo "3. Review the CHANGELOG.md entries"
229
+ echo "4. Ensure no duplicate version exists on PyPI"
253
230
echo ""
254
- echo "🚨 Only approve if everything works correctly !"
231
+ echo "🚨 Only approve if everything is correct !"
255
232
256
233
publish-pypi :
257
234
name : Publish to PyPI
@@ -289,12 +266,41 @@ jobs:
289
266
VERSION=$(ls dist/*.whl | sed -n 's/.*-\([0-9.]*\)-.*/\1/p')
290
267
echo "version=$VERSION" >> $GITHUB_OUTPUT
291
268
269
+ - name : Check if version exists on PyPI
270
+ run : |
271
+ VERSION="${{ steps.version.outputs.version }}"
272
+
273
+ # Check if version already exists on PyPI
274
+ if pip index versions bedrock-agentcore | grep -q "^Available versions.*$VERSION"; then
275
+ echo "❌ ERROR: Version $VERSION already exists on PyPI!"
276
+ echo "You cannot re-upload the same version number."
277
+ echo "Please bump the version and try again."
278
+ exit 1
279
+ fi
280
+
281
+ echo "✓ Version $VERSION is not on PyPI, safe to publish"
282
+
292
283
- name : Publish to PyPI
293
284
uses : pypa/gh-action-pypi-publish@release/v1
294
285
with :
295
- # MUST specify password to avoid Trusted Publishing
286
+ # MUST specify password to avoid Trusted Publishing issues
296
287
password : ${{ secrets.PYPI_API_TOKEN }}
297
288
skip-existing : false
289
+ verbose : true
290
+
291
+ - name : Wait for PyPI availability
292
+ run : |
293
+ VERSION="${{ steps.version.outputs.version }}"
294
+
295
+ echo "Waiting for package to be available on PyPI..."
296
+ for i in {1..10}; do
297
+ if pip index versions bedrock-agentcore | grep -q "$VERSION"; then
298
+ echo "✓ Package version $VERSION is now available on PyPI"
299
+ break
300
+ fi
301
+ echo "Attempt $i/10: Package not yet available, waiting 30s..."
302
+ sleep 30
303
+ done
298
304
299
305
- name : Create and push tag
300
306
run : |
0 commit comments