Publish Python distributions to PyPI and TestPyPI #5
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |