This action uploads python distribution packages
located in the dist/
directory to PyPI.
This action assumes that a python environment is set up. Python can be set up with conda as well
Upload packages to PyPI
- name: Publish a Python distribution to PyPI
uses: ortega2247/pypi-upload-action@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
To upload packages to TestPyPI
- name: Publish a Python distribution to PyPI
uses: ortega2247/pypi-upload-action@master
with:
user: __token__
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
If python distribution packages are located in a directory other than dist
- name: Publish a Python distribution to PyPI
uses: ortega2247/pypi-upload-action@master
with:
user: __token__
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
packages_dir: my_directory
Limit releases to tagged pushes
- name: Publish a Python distribution to PyPI
if: startsWith(github.ref, 'refs/tags/')
uses: ortega2247/pypi-upload-action@master
with:
user: __token__
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
packages_dir: my_directory
To use this action you need to get an API token from PyPI. Then, use this token to create a GitHub secret