Skip to content

Commit b1bf438

Browse files
authored
Use separate jobs and environment for PyPI and Test PyPI uploading (#275)
1 parent b541c20 commit b1bf438

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

.github/workflows/build.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,15 @@ jobs:
7474
name: cibw-sdist
7575
path: dist/*.tar.gz
7676

77-
upload_pypi:
77+
upload_test_pypi:
7878
needs: [build_wheels, build_sdist]
7979
runs-on: ubuntu-latest
80-
environment: pypi
80+
environment: test-pypi
8181
permissions:
8282
id-token: write
83-
if: github.event_name == 'release' && github.event.action == 'published'
83+
if: |
84+
(github.event_name == 'release' && github.event.action == 'published') ||
85+
(github.event_name == 'push' && github.ref == 'refs/heads/main')
8486
steps:
8587
- uses: actions/download-artifact@v4
8688
with:
@@ -95,6 +97,20 @@ jobs:
9597
uses: pypa/gh-action-pypi-publish@release/v1
9698
with:
9799
repository-url: https://test.pypi.org/legacy/
100+
101+
upload_pypi:
102+
needs: [build_wheels, build_sdist, upload_test_pypi]
103+
runs-on: ubuntu-latest
104+
environment: pypi
105+
permissions:
106+
id-token: write
107+
if: github.event_name == 'release' && github.event.action == 'published'
108+
steps:
109+
- uses: actions/download-artifact@v4
110+
with:
111+
pattern: cibw-*
112+
path: dist
113+
merge-multiple: true
98114
- name: Publish package distribution to PyPI
99115
uses: pypa/gh-action-pypi-publish@release/v1
100116

0 commit comments

Comments
 (0)