@@ -63,28 +63,51 @@ jobs:
6363 - name : Coverage
6464 uses : codecov/codecov-action@v3
6565
66- deploy :
67- # this will run when you have tagged a commit, starting with "v*"
68- # and requires that you have put your twine API key in your
69- # github secrets (see readme for details)
70- needs : [ test]
66+ # taken from https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
67+ build :
68+ name : Build distribution 📦
69+ needs :
70+ - test
7171 runs-on : ubuntu-latest
72- if : contains(github.ref, 'tags')
72+
7373 steps :
74- - uses : actions/checkout@v3
75- - name : Set up Python
76- uses : actions/setup-python@v4
77- with :
78- python-version : " 3.x"
79- - name : Install dependencies
80- run : |
81- python -m pip install --upgrade pip
82- pip install -U setuptools setuptools_scm wheel twine build
83- - name : Build and publish
84- env :
85- TWINE_USERNAME : __token__
86- TWINE_PASSWORD : ${{ secrets.TWINE_API_KEY }}
87- run : |
88- git tag
89- python -m build .
90- twine upload dist/*
74+ - uses : actions/checkout@v4
75+ - name : Set up Python
76+ uses : actions/setup-python@v5
77+ with :
78+ python-version : " 3.x"
79+ - name : Install pypa/build
80+ run : >-
81+ python3 -m
82+ pip install
83+ build
84+ --user
85+ - name : Build a binary wheel and a source tarball
86+ run : python3 -m build
87+ - name : Store the distribution packages
88+ uses : actions/upload-artifact@v4
89+ with :
90+ name : python-package-distributions
91+ path : dist/
92+
93+ publish-to-pypi :
94+ name : >-
95+ Publish Python 🐍 distribution 📦 to PyPI
96+ if : startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
97+ needs :
98+ - build
99+ runs-on : ubuntu-latest
100+ environment :
101+ name : pypi
102+ url : https://pypi.org/project/napari-crop/
103+ permissions :
104+ id-token : write # IMPORTANT: mandatory for trusted publishing
105+
106+ steps :
107+ - name : Download all the dists
108+ uses : actions/download-artifact@v4
109+ with :
110+ name : python-package-distributions
111+ path : dist/
112+ - name : Publish distribution 📦 to PyPI
113+ uses : pypa/gh-action-pypi-publish@release/v1
0 commit comments