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: | |
release: | |
types: [prereleased, released] | |
jobs: | |
build-n-publish: | |
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Install pypa/build | |
run: >- | |
python -m | |
pip install | |
build | |
--user | |
- name: Build a binary wheel and a source tarball | |
run: | | |
git fetch --prune --unshallow | |
python -m build | |
- name: Publish distribution 📦 to Test PyPI | |
# A release was created and identified as a pre-release. A pre-release is a | |
# release that is not ready for production and may be unstable. | |
if: github.event_name == 'release' && github.event.action == 'prereleased' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
- name: Publish distribution 📦 to PyPI | |
# A release was published, or a pre-release was changed to a release. | |
if: github.event_name == 'release' && github.event.action == 'released' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |