Skip to content

Upload Python Package #39

Upload Python Package

Upload Python Package #39

Workflow file for this run

# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: Upload Python Package
on:
- push
jobs:
build-n-publish:
name: Build and publish Python distributions to PyPI and TestPyPI
if: ${{ github.repository_owner == 'sphinx-contrib' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine pbr
- name: Build sdist and wheel
run: |
python setup.py sdist bdist_wheel
# - name: Publish distribution to Test PyPI
# uses: pypa/gh-action-pypi-publish@master
# with:
# password: ${{ secrets.test_pypi_password }}
# repository_url: https://test.pypi.org/legacy/
- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}