Skip to content

Commit 4264ee1

Browse files
jorisvandenbosscheEvMossanEpicWink
authored
[backport 2.3.x] CI: add PyPI Trusted-Publishing “publish” job to wheels workflow (pandas-dev#61669) (pandas-dev#61718) (pandas-dev#62395)
Co-authored-by: Evgenii Mosikhin <[email protected]> Co-authored-by: Evgenii Mosikhin <[email protected]> Co-authored-by: Laurie O <[email protected]>
1 parent 0426e59 commit 4264ee1

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