2023-10-29 14:11:25 +01:00
|
|
|
name: Publish Python package to PyPI
|
|
|
|
|
|
|
|
on:
|
2023-10-29 14:37:30 +01:00
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- '*'
|
2023-10-29 14:11:25 +01:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
publish:
|
|
|
|
name: Publish to PyPI
|
|
|
|
runs-on: ubuntu-latest
|
2023-10-29 14:37:30 +01:00
|
|
|
if: false && startsWith(github.ref, 'refs/tags/') # Only run on tagged commits
|
2023-10-29 14:11:25 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2023-10-29 16:02:10 +01:00
|
|
|
- name: Prevent fallback onto setup.py
|
|
|
|
run: rm setup.py
|
|
|
|
|
2023-10-29 14:11:25 +01:00
|
|
|
- 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/*
|
|
|
|
|