1212 build-publish :
1313 runs-on : ubuntu-latest
1414 permissions :
15- contents : write # create/ upload GitHub Release assets
16- id-token : write # OIDC for PyPI + Sigstore
15+ contents : write # upload to GitHub Releases
16+ id-token : write # OIDC for PyPI (Trusted Publisher)
1717 steps :
1818 - name : Checkout
1919 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
@@ -23,23 +23,25 @@ jobs:
2323 with :
2424 python-version : " 3.12"
2525
26- # Tools via pipx (no pipCommand)
27- - name : Install pipx + tools (pinned)
26+ # Build with pinned tool via pipx
27+ - name : Install pipx + build
2828 run : |
2929 set -euxo pipefail
3030 sudo apt-get update
3131 sudo apt-get install -y pipx
3232 pipx ensurepath
3333 echo "$HOME/.local/bin" >> "$GITHUB_PATH"
3434 pipx install build==1.2.2
35- pipx install twine==5.1.1
3635
3736 - name : Build distributions
37+ run : python -m build -o dist
38+
39+ - name : Twine check wheels/sdist
3840 run : |
39- pyproject-build -o dist
41+ pipx install twine==5.1.1
4042 twine check dist/*
4143
42- - name : Create GitHub Release (upload artifacts)
44+ - name : Create GitHub Release (attach artifacts)
4345 uses : softprops/action-gh-release@62c96d0c4e8a889135c1f3a25910db8dbe0e85f7 # v2.3.4
4446 with :
4547 files : |
4850 env :
4951 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
5052
51- - name : Publish to PyPI (OIDC)
53+ - name : Publish to PyPI (OIDC Trusted Publisher )
5254 if : startsWith(github.ref, 'refs/tags/')
5355 uses : pypa/gh-action-pypi-publish@f8d218034565c4b29629e190f46f5d54e3637bf4 # v1.12.2
5456 with :
5557 print-hash : true
56-
57- sign-release :
58- needs : build-publish
59- runs-on : ubuntu-latest
60- permissions :
61- contents : write
62- id-token : write # keyless Sigstore
63- steps :
64- - name : Sign & attach with Sigstore
65- uses : sigstore/gh-action-sigstore-python@f7ad0af51a5648d09a20d00370f0a91c3bdf8f84 # v3.0.1
66- with :
67- release-signing-artifacts : true
0 commit comments