Skip to content

Add pyproject (#48) #273

Add pyproject (#48)

Add pyproject (#48) #273

Workflow file for this run

name: Build wheels and upload to PyPI
on: [push, pull_request]
jobs:
build_dist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.X'
- name: Build sdist and wheel
run: |
python -m pip install build
python -m build
- uses: actions/upload-artifact@v4
with:
path: dist/*
retention-days: 1
upload_pypi:
needs: [build_dist]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
# alternatively, to publish when a GitHub Release is created, use the following rule:
# if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
# To test: repository_url: https://test.pypi.org/legacy/