abichinger / semantic-release-pypi

semantic-release plugin to publish a python package to PyPI
MIT License
26 stars 11 forks source link

workflow: How to get release tag on same commit as updating setup.cfg version #18

Closed nickderobertis closed 2 years ago

nickderobertis commented 2 years ago

First, thanks for this great library. I'm using semantic-release on my JS and Github Actions repos and am just trying to bring it to my Python ones as well.

I'm trying to figure out how I can get the version tag in the repo to match up with setup.cfg being updated. Right now, I'm using the semantic-release-action to release in Github Actions. Initially, it wasn't saving the change to setup.cfg, so I added a workflow step to commit and push the change. But now, the commit before the one with the version change gets tagged as the released version, so the setup.cfg does not match. The setup.cfg matches after the next commit, but if someone navigates to the repository based on the version tag, they will see the last version in setup.cfg, which could confuse users.

I think this would need to be solved in the library, because making the change to setup.cfg and creating the tag all happen within running semantic-release. For example, perhaps add an option to commit to the branch.

I need the version somewhere, because I build documentation with the version embedded.

If you think this is a good direction, I'm happy to work on a PR. Otherwise, please let me know your thoughts.

abichinger commented 2 years ago

Hello and thank you!

Did you include setup.cfg in your assets? (here is an example)

nickderobertis commented 2 years ago

Hello and thank you!

Did you include setup.cfg in your assets? (here is an example)

Wow, thank you for this quick and helpful response. This is exactly what I was looking for and I just confirmed it is working well for me.

I had seen the @semantic-release/git plugin but didn't realize it was useful for this purpose. I now see that it completely solves this issue with no changes needed to semantic-release-pypi.

I have a feeling I may not be the only one that runs into this, though. This issue may help, but I wonder if there should be a section added to the README highlighting this. I'm happy to put up a PR for that.

abichinger commented 2 years ago

I have a feeling I may not be the only one that runs into this, though. This issue may help, but I wonder if there should be a section added to the README highlighting this. I'm happy to put up a PR for that.

Contributions are always welcome. You could add it to the usage example.

abichinger commented 1 year ago

:tada: This issue has been resolved in version 2.5.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: