Open reingart opened 1 year ago
Yes workflow is extremely necessary. So I want to work over this issue.
name: Publish Python 🐍 distributions 📦 to PyPI and Test PyPI
on: push: branches:
jobs: build-n-publish: name: Build and publish Python 🐍 distributions 📦 to PyPI and Test PyPI runs-on: ubuntu-18.04 steps:
uses: actions/checkout@v2
name: Set up Python uses: actions/setup-python@v2 with: python-version: 3.8
name: Install pip run: python -m pip install --upgrade pip
name: Install dependencies run: | python -m pip install --upgrade setuptools wheel twine
name: Build package run: python setup.py sdist bdist_wheel
name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@master with: user: token password: ${{ secrets.PYPI_API_TOKEN }}
name: Publish distribution 📦 to Test PyPI if: secrets.TEST_PYPI_API_TOKEN != '' uses: pypa/gh-action-pypi-publish@release/v1 with: user: token password: ${{ secrets.TEST_PYPI_API_TOKEN }} repository_url: https://test.pypi.org/legacy/
We need a new GitHub Action workflow to automatically publish this package to PyPI (Python Package Index)
This will be useful for other project, to ease their installation. For example see a thread for the Odoo Argentine localization: https://github.com/reingart/pyafipws/issues/102
How-To: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
The GitHub Action pypa/gh-action-pypi-publish could be easily added to
.github//workflows/python-package.yml
:This action should only run if
secrets.TEST_PYPI_API_TOKEN
is configured