Add action to publish to real PyPI

This commit is contained in:
Dominik Moritz Roth 2023-10-29 14:11:25 +01:00
parent 049e45cb09
commit be250bee5e

38
.github/workflows/publish-to-pypi.yml vendored Normal file
View File

@ -0,0 +1,38 @@
name: Publish Python package to PyPI
on:
push:
tags:
- '*'
jobs:
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') # Only run on tagged commits
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install pypa/build/setuptools/twine
run: >-
python3 -m
pip install
build setuptools twine
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: twine upload dist/*