Skip to content

v2.5.1

v2.5.1 #93

Workflow file for this run

name: Publish release to PyPI
on:
push:
branches:
- main
release:
types:
- created
jobs:
build-and-publish:
name: Build and publish Python distributions to PyPI and TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install flit
run: python -m pip install flit
- name: Build a binary wheel and a source tarball
run: flit build
- name: Publish distribution to Test PyPI
# We’d like to always publish to Test PyPI in order to spot errors with
# the publish step, however, this would require a new version each time
# we make a (test) release. For now, use the same logic for test as for
# the real release.
if: startsWith(github.ref, 'refs/tags') || github.event_name == 'release'
run: flit publish
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
FLIT_INDEX_URL: https://test.pypi.org/legacy/
- name: Publish distribution to PyPI
# Only publish to main PyPI when it is a tagged release
if: startsWith(github.ref, 'refs/tags') || github.event_name == 'release'
run: flit publish
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
FLIT_INDEX_URL: https://upload.pypi.org/legacy/