Repository navigation
Closed
Closed
Copy link
Labels
Description
Question
I have a Cookiecutter template and an instance of the template.
The instance is in a broken state, as it seems that PSR can't detect the current version in order to bump.
❯ semantic-release -v version
[10:30:51] INFO [util.load_raw_config_file] Loading configuration from pyproject.toml util.py:79
INFO [config.select_branch_options] Using group 'main' options, as 'main' matches 'main' config.py:590
WARNING [config.from_raw_config] Token value is missing! config.py:785
INFO [algorithm.tags_and_versions] found 2 previous tags algorithm.py:62
INFO [algorithm.next_version] No full releases found in this branch's history algorithm.py:300
INFO [algorithm.next_version] The latest release in this branch's history was 0.0.0 algorithm.py:330
INFO [algorithm.next_version] Found 74 commits since the last release! algorithm.py:342
INFO [algorithm.next_version] The type of the next release release is: minor algorithm.py:399
0.1.0
INFO [algorithm.tags_and_versions] found 2 previous tags algorithm.py:62
No release will be made, 0.1.0 has already been released!
INFO [github_actions_output.write_if_possible] not writing GitHub Actions output, as no file specified github_actions_output.py:74
Configuration
Semantic Release Configuration
[tool.semantic_release]
version_toml = ["pyproject.toml:project.version"]
build_command = """
pip install uv
uv lock
git add uv.lock
uv build
"""
[tool.semantic_release.changelog.default_templates]
changelog_file = "docs/CHANGELOG.md"
[tool.semantic_release.branches.main]
match = "main"
[tool.semantic_release.branches.rc]
match = "rc"
prerelease = true
prerelease_token = "rc"Additional context
git log --oneline --decorate --graph --all -n 50
* 0cad873 (HEAD -> main, origin/main, origin/HEAD) feat: lock
* 6e04c3f feat: template update
* aa2a3f7 chore: update template
* 4bef4e4 chore: update template
* 1a76d3f chore: update template
* 80023be chore: update template
* a2e739d Merge pull request #21 from MicaelJarniac:MicaelJarniac/issue20
|\
| * d77f929 build(deps): update Poetry to 2.0
|/
* a348dcc chore: template update
| * 7c1f16c (origin/dependabot/pip/virtualenv-20.26.6) build(deps-dev): bump virtualenv from 20.26.3 to 20.26.6
|/
| * 38c1195 (origin/dependabot/pip/jinja2-3.1.5) build(deps-dev): bump jinja2 from 3.1.4 to 3.1.5
|/
* ecc77b6 chore: Poetry lock
* 0a3bfee chore: update cruft
| * 03bab77 (MicaelJarniac/issue16) chore: fix new Ruff
| * c7472ac chore: update Ruff and use to format
| * 978dafa chore: remove Black
|/
* e08eefb Merge pull request #12 from MicaelJarniac:template-update
|\
| * ae3faad fix: template update
|/
* 25e6968 chore: lockfile
* d9a027f Merge pull request #11 from MicaelJarniac:update-template
|\
| * 2973b9d chore: update template
|/
* ee4f1fc chore: template update
* 12a0674 feat: add benchmarking tools (#10)
* df022f4 chore: update template
* b0fcdbe chore: remove `stubs` Poetry dependency group (#8)
* 7af6ce2 chore: template update
* f483ae2 chore: template update (#6)
* f404355 build(release): update Python Semantic Release
* d54c2f7 0.1.1
* 12deb0a build(release): fix build command
* f6310dc fix: force release
* 6300616 build(release): `build_command = "python -m build"`
* 3998d47 build: remove version classifiers, Poetry will add
* bda1c81 build: fix URLs
* 54e0f0c build(docs): fix Poetry install command
* ef171f1 docs(readme): fix action badge
* 161bbb1 0.1.0
* 62b76a6 Revert "0.1.0"
* 1654708 0.1.0
* 5fef332 Revert "0.1.0"
* 3c82321 0.1.0
* f8dcba6 build(release): write permissions
* 0f62c43 build: install Poetry to build
| * f27d87c (tag: v0.1.1) 0.1.1
| * f572ae9 build(release): fix build command
| * 05ca4a6 fix: force release
| * d6b8234 build(release): `build_command = "python -m build"`
| * b2cb415 Merge pull request #4 from MicaelJarniac/template
| |\
| | * 53f677c build: remove version classifiers, Poetry will add
| | * 83427df build: fix URLs
Activity
codejedi365 commentedon Feb 15, 2025
@MicaelJarniac, thank you for the git history graph although since your history is longer than 50 commits I can't be certain. But from what I see in the logs and in the commit history, there are no tags in the main branch. Instead your v0.1.1 is in another branch which is not part of the history.
It will evaluate the next version based on what tags are in the current HEAD's history. Which because there are feature commits it will be a minor bump to the base version of
0.0.0as no tag was detected otherwise. The problem is the tag `v0.1.0 already exists so it can't be created again.The incompatibility stems from your merging and release strategy, which I'm not sure what you are trying to accomplish there. Seems like ReleaseFlow but not as I would have expected it.
MicaelJarniac commentedon Feb 15, 2025
Thanks a lot for the reply!
I think you're right, the tags seem to have been created on branches I've deleted.
This repo I'm working on is quite a mess. I use it as a testing ground for a template I'm creating.
Full history
Is there a way to force PSR to release a specific version, something like
semantic-release version --force 0.2.0? I know I can force bumps, but I couldn't find a way to force an exact version. I suppose I could force a bump to major, but that'd then get me out of SemVer's special 0.x.x behavior.codejedi365 commentedon Feb 15, 2025
No, there isn't. We expect you to use git locally to do that if you need to set a version.
If you want to do all the other special stuff then I would locally just delete one of the previous tags and move it to the base of your new commits (within HEAD's history). Then run semantic-release locally to create the new version. Just don't push the deletion of the original tag. Then you move on from there.
If you are trying to maintain a changelog you will need to make sure you are in update mode otherwise the branched previous versions will be ignored.
MicaelJarniac commentedon Feb 17, 2025
Thanks for the clarification and the suggestions.