| 1 |
name: Publish Python distributions to PyPI |
| 2 |
on: |
| 3 |
release: |
| 4 |
types: [published] |
| 5 |
|
| 6 |
jobs: |
| 7 |
build-n-publish: |
| 8 |
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI |
| 9 |
runs-on: ubuntu-latest |
| 10 |
|
| 11 |
steps: |
| 12 |
- uses: actions/checkout@v5 |
| 13 |
with: |
| 14 |
ref: master |
| 15 |
- name: Set up Python 3.12 |
| 16 |
uses: actions/setup-python@v6 |
| 17 |
with: |
| 18 |
python-version: '3.12' |
| 19 |
|
| 20 |
- name: Install setuptools |
| 21 |
run: | |
| 22 |
python -m pip install --upgrade pip |
| 23 |
python -m pip install --upgrade setuptools wheel twine |
| 24 |
|
| 25 |
- name: Build a binary wheel and a source tarball |
| 26 |
run: | |
| 27 |
python setup.py sdist bdist_wheel |
| 28 |
|
| 29 |
- name: Publish distribution to PyPI |
| 30 |
uses: pypa/gh-action-pypi-publish@release/v1 |
| 31 |
with: |
| 32 |
user: __token__ |
| 33 |
password: ${{ secrets.pypi_api_key }} |