Github action which versions, builds and publishes python packages that use poetry
- Go to settings/secrets and add two secrets: PYPI_USERNAME and PYPI_PASSWORD
- Add a workflow:
name: Upload Python Package on: release: types: [created] jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Set up Python uses: actions/setup-python@v2 with: python-version: '3.x' - name: Build and publish uses: d1618033/gh-action-python-publish-using-poetry@master with: pypi_username: ${{ secrets.PYPI_USERNAME }} pypi_password: ${{ secrets.PYPI_PASSWORD }}
- Go to Code/releases and draft a new release.
- The tag version will become the python package version.
If there are additional arguments you want to pass to the build
or upload
commands simply add:
- name: Build and publish
uses: d1618033/gh-action-python-publish-using-poetry@master
with:
pypi_username: ${{ secrets.PYPI_USERNAME }}
pypi_password: ${{ secrets.PYPI_PASSWORD }}
poetry_build_args: '-f sdist'
twine_upload_args: '-r myrepo'