-
Notifications
You must be signed in to change notification settings - Fork 74
31 lines (27 loc) · 1.03 KB
/
pypi-publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Upload a Python package when a release is created
# https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows
name: Publish Python 🐍 distributions 📦 to PyPI
on:
release:
types: [released]
jobs:
# TODO: rewrite this as 2 separate jobs: https://github.com/cherrypy/cheroot/blob/56d7b49/.github/workflows/ci-cd.yml#L989
# Thanks @webknjaz
pypi-build-and-publish:
name: Build and upload release to PyPI
runs-on: ubuntu-latest
environment: pypi-publish
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Build a source tarball and a binary wheel
# https://pypa-build.readthedocs.io
run: |
python -m pip install build
python -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true