Skip to content

Commit 80abbe3

Browse files
committed
Add trusted publisher release workfiow
1 parent 8018643 commit 80abbe3

File tree

2 files changed

+48
-5
lines changed

2 files changed

+48
-5
lines changed

.github/workflows/release.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish Python 🐍 distribution 📦 to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
build:
10+
name: Build distribution 📦
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.x"
19+
- name: Build a binary wheel and a source tarball
20+
run: pipx run build
21+
- name: Store the distribution packages
22+
uses: actions/upload-artifact@v4
23+
with:
24+
name: python-package-distributions
25+
path: dist/
26+
27+
publish-to-pypi:
28+
name: >-
29+
Publish Python 🐍 distribution 📦 to PyPI
30+
needs:
31+
- build
32+
runs-on: ubuntu-latest
33+
environment:
34+
name: pypi
35+
url: https://pypi.org/project/pip/${{ github.ref_name }}
36+
permissions:
37+
id-token: write # IMPORTANT: mandatory for trusted publishing
38+
39+
steps:
40+
- name: Download all the dists
41+
uses: actions/download-artifact@v4
42+
with:
43+
name: python-package-distributions
44+
path: dist/
45+
- name: Publish distribution 📦 to PyPI
46+
uses: pypa/gh-action-pypi-publish@release/v1

docs/html/development/release-process.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,8 @@ Creating a new release
146146
This will update the relevant files and tag the correct commit.
147147
#. Submit the ``release/YY.N`` branch as a pull request and ensure CI passes.
148148
Merge the changes back into ``main`` and pull them back locally.
149-
#. Build the release artifacts using ``nox -s build-release -- YY.N``.
150-
This will checkout the tag, generate the distribution files to be
151-
uploaded and checkout the main branch again.
152-
#. Upload the release to PyPI using ``nox -s upload-release -- YY.N``.
153-
#. Push the tag created by ``prepare-release``.
149+
#. Push the tag created by ``prepare-release``. This will trigger the release
150+
workflow on GitHub and publish to PyPI.
154151
#. Regenerate the ``get-pip.py`` script in the `get-pip repository`_ (as
155152
documented there) and commit the results.
156153
#. Submit a Pull Request to `CPython`_ adding the new version of pip

0 commit comments

Comments
 (0)