Skip to content

semantic-release version extracts release version from unrelated commit by renovatebot #464

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

Closed
KDMichaelis opened this issue Jul 6, 2022 · 3 comments
Labels
bug Something isn't working properly

Comments

@KDMichaelis
Copy link

The problem

I'm currently introducing python-semantic-release into a project with a long previous commit history. When initially running semantic-release version with version_source = "commit" the command fails without an error message, and I am seeing the following:

Creating new version
Current version: 0.1.0, Current release version: 2.1.5

The current release version number seems to be extracted from an old commit created by renovatebot with the following title:

chore(deps): update abatilo/actions-poetry action to v2.1.5

Obviously, this title is completely unrelated to my project version number. A possible workaround by manually including a commit with the current release version before running semantic-release version (so the current release version is read from this commit instead of the other one) would be unfeasible because then this number has to be known in advance.

Expected behavior

Instead of extracting a version number from one of the commit messages, I would expect the version number to be automatically generated based on the previous version from pyproject.toml, which is then bumped according to conventional commit messages. Nice to have: If an error occurs for some reason, an error message should be printed. There is none even when using the according verbosity level.

Additional context

My current version (which is the initial version of my project) is stored as version = "0.1.0" in pyproject.toml and accordingly I'm using the configuration version_toml = "pyproject.toml:tool.poetry.version".

I would like to use semantic-release publish in a GitHub Actions workflow and most of it seems to be working when I use version_source = "tag". However, this is not automatically updating the version number in pyproject.toml, as well as committing and pushing the changed files (including the changelog), and it seems impossible to make this happen without changing the version_source. Updating the number in the file manually after semantic-release publish and then adding a separate commit seems strenuous as this is exactly what I want (and expect) semantic-release publish to take care of for me.

As a side note, based on the documentation, it is unclear to me how exactly "Current version" and "Current release version" are distinguished. Is the "Current release version" the new version of the "Current version" after the version bump (is one of them "old" instead of "current" and the other one "new" instead of "current"), or is one of them the project/package version and the other one the release version (which I would think should always be identical)?

@KDMichaelis KDMichaelis added the bug Something isn't working properly label Jul 6, 2022
@KDMichaelis
Copy link
Author

As additional info here the outputs of semantic-release print-version:

semantic-release print-version --current -D version_source="tag"
0.0.0
semantic-release print-version --next -D version_source="tag"
1.0.0
semantic-release print-version --current -D version_source="commit"
0.1.0

The following prints nothing and results in an error:

semantic-release print-version --next -D version_source="commit"

@alandtse
Copy link
Contributor

alandtse commented Jul 10, 2022

It's probably a dupe of #442. Work around is to pin to 7.28.1

@KDMichaelis
Copy link
Author

Indeed downgrading to 7.28.1 fixed it and I was able to use version_source = "commit". Closing in favor of #442.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working properly
Projects
None yet
Development

No branches or pull requests

2 participants