-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python: publish on version bump only #230
Conversation
Since #228, the Python workflow will run for any changes in the Python code, the shared test resources _and_ the Python workflow itself. This means that when the library version does not change, the `publish` step simply fails, which does not look good. This updates the Python workflow so that it will only attempt to publish the library when there is a `python/v**` tag being pushed. It does mean that it now requires an additional manual step, but it also means that we can more easily batch changes in each version bump, without the workflow failing in between.
5757e30
to
7a8d9ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, although I would like to avoid the manual step.
How about a script that checks if the version exists and leaves a warning annotation?
if ! VERSION="$(grep -m1 'version = "' pyproject.toml | cut -d'"' -f2)"; then exit 1; fi
STATUS_CODE=$(curl --write-out %{http_code} --silent --output /dev/null "https://pypi.org/pypi/truelayer-signing/${VERSION}/json")
if [ $STATUS_CODE -eq 200 ] ; then
echo "::warning truelayer-signing:$VERSION::Version already exists skipping publication."
else
poetry build
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
poetry publish
fi
@tl-flavio-barinas I don't mind at all if that's your preference. I think this should work well for whoever maintains the specific library really. The one thing worth pointing out is that skipping the ![]() |
@tl-flavio-barinas maybe we can find a way of doing your check in the job's conditional statement though, as opposed to doing it in an execution step? |
It would be nice if we could filter at a job level. Not sure it's possible, though. We could rename the job to |
40d1263
to
3ef50eb
Compare
3ef50eb
to
90e1d85
Compare
a7ec69d
to
947322a
Compare
@tl-flavio-barinas I've updated the workflow as such:
This removes the manual step of tagging and keeps the workflow elegant, with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Since #228, the Python workflow will run for any changes in the Python
code, the shared test resources and the Python workflow itself. This
means that when the library version does not change, the
publish
stepsimply fails, which does not look good.
This updates the Python workflow so that it will only attempt to publish
the library automatically when there is a version bump on
main
.