Skip to content

Commit 0864817

Browse files
authored
Update python-package.yml to publish to PyPi for every release (#2381)
I know that the typical release is uploaded to PyPi manually, however I figure I'd draft a PR with these changes because having the option to start doing this is worthwhile. More info can be found on https://github.com/pypa/gh-action-pypi-publish.
1 parent 364397c commit 0864817

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

.github/workflows/python-package.yml

+18
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,21 @@ jobs:
178178
uses: re-actors/alls-green@release/v1
179179
with:
180180
jobs: ${{ toJSON(needs) }}
181+
publish:
182+
name: 📦 Publish to PyPI
183+
runs-on: ubuntu-latest
184+
needs: [build-sdist]
185+
permissions:
186+
id-token: write
187+
environment: pypi
188+
if: github.event_name == 'release' && github.event.action == 'created'
189+
steps:
190+
- name: Download the sdist artifact
191+
uses: actions/download-artifact@v3
192+
with:
193+
name: artifact
194+
path: dist
195+
- name: Publish package to PyPI
196+
uses: pypa/gh-action-pypi-publish@release/v1
197+
with:
198+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)