@@ -191,10 +191,9 @@ jobs:
191191 branch : gh-pages
192192 folder : dist
193193
194- publish-pypi :
195- name : Publish to PyPI
194+ pip-build :
195+ name : Build with pip and publish to PyPI
196196 needs : test
197- if : github.ref == 'refs/heads/main'
198197 runs-on : ubuntu-latest
199198 steps :
200199 - name : Check out the repository
@@ -205,16 +204,16 @@ jobs:
205204 - name : Set up Python
206205 uses : actions/setup-python@v6
207206 with :
208- python-version : ' 3.12 '
207+ python-version : ' 3.10 '
209208 - name : Install dependencies
210209 run : |
211210 python -m pip install --upgrade pip
212211 pip --version
213212 pip install --upgrade build
214213 pip install .
215- pip install pytest
216- - name : run tests
217- run : pytest --disable-pytest-warnings
214+ - name : Build package
215+ run : |
216+ python -m build
218217
219218 - name : Check if there is a parent commit
220219 id : check-parent-commit
@@ -223,7 +222,7 @@ jobs:
223222
224223 - name : Detect new version
225224 id : check-version
226- if : steps.check-parent-commit.outputs.sha
225+ if : github.ref == 'refs/heads/main' && steps.check-parent-commit.outputs.sha
227226228227 with :
229228 create-tag : false
@@ -232,24 +231,22 @@ jobs:
232231
233232 - name : Push tag
234233 id : tag-version
235- if : steps.check-version.outputs.previous-version != steps.check-version.outputs.current-version
234+ if : github.ref == 'refs/heads/main' && steps.check-version.outputs.previous-version != steps.check-version.outputs.current-version
236235 uses :
mathieudutour/[email protected] 237236 with :
238237 github_token : ${{ secrets.GITHUB_TOKEN }}
239238 custom_tag : ${{ steps.check-version.outputs.current-version }}
240239
241- - name : Build package
242- run : |
243- python -m build
244240 - name : Publish package on PyPI
245- if : steps.tag-version.outputs.new_tag
241+ if : github.ref == 'refs/heads/main' && steps.tag-version.outputs.new_tag
246242 uses : pypa/gh-action-pypi-publish@release/v1.12
247243 with :
248244 user : __token__
249245 password : " ${{ secrets.PYPI_TOKEN }}"
250246 packages-dir : dist/
251247 verbose : true
252248 - name : Publish the release notes
249+ if : github.ref == 'refs/heads/main'
253250 uses :
release-drafter/[email protected] 254251 with :
255252 publish : " ${{ steps.tag-version.outputs.new_tag != '' }}"
0 commit comments