Skip to content

Publish Python distributions to PyPI and TestPyPI #3

Publish Python distributions to PyPI and TestPyPI

Publish Python distributions to PyPI and TestPyPI #3

Workflow file for this run

name: Publish Python distributions to PyPI and TestPyPI
on:
push:
tags:
- '*'
jobs:
build-n-publish:
name: Build and publish to PyPI
runs-on: ubuntu-latest
env:
ENV_NAME: publish
PYTHON: 3.9
steps:
- uses: actions/checkout@main
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ env.PYTHON }}
- name: Install build
run: pip install build
- name: Build a binary wheel and a source tarball
run: |
python -m build
- name: Publish to PyPI
if: startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}