One can use github actions to publish to PyPI everytime there is an updated on the master branch.
For example, one can use: https://github.com/marketplace/actions/publish-python-poetry-package
For good reasons, publication on PyPI will fail if the version number is not updated ("HTTP Error 400: File already exists."). (good reasons explained here: https://pypi.org/help/#file-name-reuse)
Yet, content of the master branch may sometimes be updated in ways that do not justify an update of the version number (e.g. if the github actions, not the software, is updated).
What would be recommended way to handle this, and how can it be implemented ? For example, is it possible to trigger the github action for publishing only if there is a version update ? or only if the source code has been updated ? Or is there a way to ignore the Http Error 400 (i.e. not getting a failure badge if this error occurs) ?
As suggested by @sinoroc, seems suitable to publish on new tag.
---
name: pypi_publish
on:
push:
tags:
- '**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build and publish to pypi
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}