11name : Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
22# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
3- on : push
3+ on :
4+ release :
5+ types : [published]
46
57jobs :
68 build :
@@ -16,23 +18,23 @@ jobs:
1618 - name : Install pypa/build
1719 run : pip install build
1820 - name : Build a binary wheel and a source tarball
19- run : python -m build
21+ run : python3 -m build
2022 - name : Store the distribution packages
2123 uses : actions/upload-artifact@v4
2224 with :
2325 name : python-package-distributions
2426 path : dist/
27+ if-no-files-found : error
2528
2629 publish-to-pypi :
2730 name : >-
2831 Publish Python 🐍 distribution 📦 to PyPI
29- if : startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
3032 needs :
3133 - build
3234 runs-on : ubuntu-latest
3335 environment :
3436 name : pypi
35- url : https://pypi.org/p/autointent
37+ url : https://pypi.org/p/autointent # Replace <package-name> with your PyPI project name
3638 permissions :
3739 id-token : write # IMPORTANT: mandatory for trusted publishing
3840
4244 with :
4345 name : python-package-distributions
4446 path : dist/
47+
4548 - name : Publish distribution 📦 to PyPI
4649 uses : pypa/gh-action-pypi-publish@release/v1
4750
@@ -63,51 +66,19 @@ jobs:
6366 with :
6467 name : python-package-distributions
6568 path : dist/
69+
6670 - name : Sign the dists with Sigstore
67716872 with :
6973 inputs : >-
7074 ./dist/*.tar.gz
7175 ./dist/*.whl
72- - name : Create GitHub Release
73- env :
74- GITHUB_TOKEN : ${{ github.token }}
75- run : >-
76- gh release create
77- '${{ github.ref_name }}'
78- --repo '${{ github.repository }}'
79- --generate-notes
80- - name : Upload artifact signatures to GitHub Release
76+ release-signing-artifacts : false # Prevent the action from uploading artifacts, because, by default it will uplpoad artifacts with tag name too
77+
78+ - name : Upload artifacts to release
79+ uses : softprops/action-gh-release@v1
80+ with :
81+ files : |
82+ ./dist/*
8183 env :
8284 GITHUB_TOKEN : ${{ github.token }}
83- # Upload to GitHub Release using the `gh` CLI.
84- # `dist/` contains the built packages, and the
85- # sigstore-produced signatures and certificates.
86- run : >-
87- gh release upload
88- '${{ github.ref_name }}' dist/**
89- --repo '${{ github.repository }}'
90-
91- # publish-to-testpypi:
92- # name: Publish Python 🐍 distribution 📦 to TestPyPI
93- # needs:
94- # - build
95- # runs-on: ubuntu-latest
96-
97- # environment:
98- # name: testpypi
99- # url: https://test.pypi.org/p/autointent
100-
101- # permissions:
102- # id-token: write # IMPORTANT: mandatory for trusted publishing
103-
104- # steps:
105- # - name: Download all the dists
106- # uses: actions/download-artifact@v4
107- # with:
108- # name: python-package-distributions
109- # path: dist/
110- # - name: Publish distribution 📦 to TestPyPI
111- # uses: pypa/gh-action-pypi-publish@release/v1
112- # with:
113- # repository-url: https://test.pypi.org/legacy/
0 commit comments