Skip to content

Commit 265a34a

Browse files
EvMossanEpicWinkjorisvandenbossche
committed
CI: add PyPI Trusted-Publishing “publish” job to wheels workflow (#61669) (#61718)
Co-authored-by: Evgenii Mosikhin <147685598+evgmosme@users.noreply.github.com> Co-authored-by: Laurie O <laurie_opperman@hotmail.com> Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
1 parent a25f560 commit 265a34a

File tree

2 files changed

+44
-3
lines changed

2 files changed

+44
-3
lines changed

.github/workflows/wheels.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
name: Wheel builder
1414

1515
on:
16+
release:
17+
types: [published]
1618
schedule:
1719
# 3:27 UTC every day
1820
- cron: "27 3 * * *"
@@ -206,3 +208,41 @@ jobs:
206208
source ci/upload_wheels.sh
207209
set_upload_vars
208210
upload_wheels
211+
212+
publish:
213+
if: >
214+
github.repository == 'pandas-dev/pandas' &&
215+
github.event_name == 'release' &&
216+
startsWith(github.ref, 'refs/tags/v')
217+
218+
needs:
219+
- build_sdist
220+
- build_wheels
221+
222+
runs-on: ubuntu-latest
223+
224+
environment:
225+
name: pypi
226+
permissions:
227+
id-token: write # OIDC for Trusted Publishing
228+
contents: read
229+
230+
steps:
231+
- name: Download all artefacts
232+
uses: actions/download-artifact@v4
233+
with:
234+
path: dist # everything lands in ./dist/**
235+
236+
- name: Collect files
237+
run: |
238+
mkdir -p upload
239+
# skip any wheel that contains 'pyodide'
240+
find dist -name '*pyodide*.whl' -prune -o \
241+
-name '*.whl' -exec mv {} upload/ \;
242+
find dist -name '*.tar.gz' -exec mv {} upload/ \;
243+
244+
- name: Publish to **PyPI** (Trusted Publishing)
245+
uses: pypa/gh-action-pypi-publish@release/v1
246+
with:
247+
packages-dir: upload
248+
skip-existing: true

doc/source/development/maintaining.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -467,9 +467,10 @@ which will be triggered when the tag is pushed.
467467
- Set as the latest release: Leave checked, unless releasing a patch release for an older version
468468
(e.g. releasing 1.4.5 after 1.5 has been released)
469469

470-
5. Upload wheels to PyPI::
471-
472-
twine upload pandas/dist/pandas-<version>*.{whl,tar.gz} --skip-existing
470+
5. Verify wheels are uploaded automatically by GitHub Actions
471+
via `**Trusted Publishing** <https://docs.pypi.org/trusted-publishers/>`__
472+
when the GitHub `*Release* <https://docs.github.com/en/repositories/releasing-projects-on-github/about-releases>`__
473+
is published. Do not run ``twine upload`` manually.
473474

474475
6. The GitHub release will after some hours trigger an
475476
`automated conda-forge PR <https://github.com/conda-forge/pandas-feedstock/pulls>`_.

0 commit comments

Comments
 (0)