22
33on :
44 workflow_dispatch :
5- release :
6- types :
7- - published
5+ push :
6+ tags :
7+ - " v* "
88 schedule :
99 - cron : " 0 0 * * 1"
1010
3030
3131 - uses : actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
3232 with :
33- python-version : 3.12
33+ python-version : 3.13
3434
3535 - name : Build source distribution
3636 run : pipx run build --sdist --outdir dist/
@@ -432,7 +432,7 @@ jobs:
432432 contents : write # Required to upload signed artifacts to a GitHub release
433433 attestations : write # Required to generate build provenance attestations
434434 runs-on : ubuntu-latest
435- if : github.event_name == 'release' && github.event.action == 'published'
435+ if : startsWith( github.ref, 'refs/tags/')
436436
437437 steps :
438438 - name : Download all artifacts
@@ -442,7 +442,6 @@ jobs:
442442 merge-multiple : true
443443
444444 - uses : pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
445- if : github.event_name == 'release' && github.event.action == 'published'
446445 with :
447446 # Comment this line out to publish to PyPI
448447 # repository-url: https://test.pypi.org/legacy/
@@ -462,12 +461,14 @@ jobs:
462461 upload/*.whl
463462 upload/*.tar.gz
464463
465- - name : Publish to GitHub Releases
466- # Wait for https://github.com/softprops/action-gh-release/issues/556 to be resolved
467- # before bumping to v2.2.0.
468- uses : softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1
469- if : github.event_name == 'release' && github.event.action == 'published'
470- with :
471- # This will contain not only the wheel and sdist, but also the signature files
472- # generated by the Sigstore action
473- files : upload/*
464+ - name : Create GitHub Release and upload artifacts
465+ env :
466+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
467+ run : |
468+ # Create a draft release and upload all artifacts (wheels, sdist, and
469+ # Sigstore signatures), then publish — the release becomes immutable
470+ # once it is no longer a draft
471+ gh release create "${GITHUB_REF_NAME}" upload/* \
472+ --draft \
473+ --generate-notes
474+ gh release edit "${GITHUB_REF_NAME}" --draft=false
0 commit comments