@@ -142,9 +142,8 @@ jobs:
142142 ### 🔄 Release Process
143143 After merging this PR:
144144 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
148147
149148 ### 🚨 Running from: ${{ github.ref }}
150149 ${{ github.ref != 'refs/heads/main' && '**WARNING**: Not running from main branch!' || '✅ Running from main branch' }}
@@ -208,50 +207,28 @@ jobs:
208207 name : dist
209208 path : dist/
210209
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-
232210 release-approval :
233211 name : Release Approval
234- needs : publish-testpypi
212+ needs : test-and-build
235213 runs-on : ubuntu-latest
236- # IMPORTANT: Always run if test PyPI succeeded
237- if : always() && needs.publish-testpypi.result == 'success'
238214 environment :
239215 name : pypi-approval
240216
241217 steps :
242218 - name : Approval checkpoint
243219 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 "
246222 echo ""
247223 echo "⚠️ MANUAL APPROVAL REQUIRED FOR PRODUCTION"
248224 echo ""
249225 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"
253230 echo ""
254- echo "🚨 Only approve if everything works correctly !"
231+ echo "🚨 Only approve if everything is correct !"
255232
256233 publish-pypi :
257234 name : Publish to PyPI
@@ -289,12 +266,41 @@ jobs:
289266 VERSION=$(ls dist/*.whl | sed -n 's/.*-\([0-9.]*\)-.*/\1/p')
290267 echo "version=$VERSION" >> $GITHUB_OUTPUT
291268
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+
292283 - name : Publish to PyPI
293284 uses : pypa/gh-action-pypi-publish@release/v1
294285 with :
295- # MUST specify password to avoid Trusted Publishing
286+ # MUST specify password to avoid Trusted Publishing issues
296287 password : ${{ secrets.PYPI_API_TOKEN }}
297288 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
298304
299305 - name : Create and push tag
300306 run : |
0 commit comments