Skip to content

Commit e817930

Browse files
EvMossanEpicWinkjorisvandenbossche
authored
CI: add PyPI Trusted-Publishing “publish” job to wheels workflow (#61669) (#61718)
Co-authored-by: Evgenii Mosikhin <[email protected]> Co-authored-by: Laurie O <[email protected]> Co-authored-by: Joris Van den Bossche <[email protected]>
1 parent 10a5305 commit e817930

File tree

3 files changed

+45
-3
lines changed

3 files changed

+45
-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 * * *"
@@ -216,3 +218,41 @@ jobs:
216218
source ci/upload_wheels.sh
217219
set_upload_vars
218220
upload_wheels
221+
222+
publish:
223+
if: >
224+
github.repository == 'pandas-dev/pandas' &&
225+
github.event_name == 'release' &&
226+
startsWith(github.ref, 'refs/tags/v')
227+
228+
needs:
229+
- build_sdist
230+
- build_wheels
231+
232+
runs-on: ubuntu-latest
233+
234+
environment:
235+
name: pypi
236+
permissions:
237+
id-token: write # OIDC for Trusted Publishing
238+
contents: read
239+
240+
steps:
241+
- name: Download all artefacts
242+
uses: actions/download-artifact@v4
243+
with:
244+
path: dist # everything lands in ./dist/**
245+
246+
- name: Collect files
247+
run: |
248+
mkdir -p upload
249+
# skip any wheel that contains 'pyodide'
250+
find dist -name '*pyodide*.whl' -prune -o \
251+
-name '*.whl' -exec mv {} upload/ \;
252+
find dist -name '*.tar.gz' -exec mv {} upload/ \;
253+
254+
- name: Publish to **PyPI** (Trusted Publishing)
255+
uses: pypa/gh-action-pypi-publish@release/v1
256+
with:
257+
packages-dir: upload
258+
skip-existing: true

doc/source/development/maintaining.rst

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

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

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

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ Other enhancements
226226
- Support passing a :class:`Iterable[Hashable]` input to :meth:`DataFrame.drop_duplicates` (:issue:`59237`)
227227
- Support reading Stata 102-format (Stata 1) dta files (:issue:`58978`)
228228
- Support reading Stata 110-format (Stata 7) dta files (:issue:`47176`)
229+
- Switched wheel upload to **PyPI Trusted Publishing** (OIDC) for release-tag pushes in ``wheels.yml``. (:issue:`61718`)
229230
-
230231

231232
.. ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)