Skip to content

Commit 3e4048c

Browse files
committed
test pip build in PRs as well
1 parent f67dd4a commit 3e4048c

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

.github/workflows/build.yaml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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
227226
uses: salsify/[email protected]
228227
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

Comments
 (0)