question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

python-semantic-release should have an option to pull version_variable from git tag

See original GitHub issue

python-semantic-release should have an option to pull version_variable from git tag

python-semantic-release requires version_variable to be in a file and bumps and auto-commits it.

For parity with semantic-release per https://semantic-release.gitbook.io/semantic-release/support/faq#why-is-the-package-jsons-version-not-updated-in-my-repository semantic release updates package.json then prepares and publishes the package and doesn’t auto-commit the version change.

This is desirable for CI so that auto-commits don’t require troublesome exceptions to prevent an infinite loop of version bumps.

If we don’t push the commit to the version_variable subsequent runs report the following error

Creating new version..
Current version: 0.0.0
Cmd('git') failed due to: exit code(128)
  cmdline: git tag -m v0.0.1 -a v0.0.1
  stderr: 'fatal: tag 'v0.0.1' already exists'

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
fattybenjicommented, Sep 4, 2019
0reactions
fattybenjicommented, Sep 2, 2019

Ok, I’m going to do the following :

  • If version_source is commit, will get version from version_variable file and edit the file with the new version. If variable commit_changes is defined and False, won’t commit. If it is undefined or True, will commit and push changes.
  • If version_source is tag, will get version from VCS and will edit the file defined in version_variable. If the file doesn’t exist, will fail silently (backwards compatibility). If variable commit_changes is defined and True, will commit and push changes. If it is undefined or False, won’t push.

I intend to do that by setting the actual value of commit_changes as :

commit_changes = config.get('semantic_release', 'commit_changes', fallback=(version_source == 'commit'))

This way, we will have a full backward compatibility with the current behavior, while giving people the choice to do differently. This can be discussed when I submit the PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python-semantic-release should have an option to ... - GitHub
python -semantic-release should have an option to pull version_variable from git tag. python-semantic-release requires version_variable to be ...
Read more >
Configuration — python-semantic-release 7.32.2 documentation
If set to tag , will get the current version from the latest tag matching vX.Y.Z . This won't change the source defined...
Read more >
Semantic release with Python, Poetry & GitHub Actions
To manage this automatic versioning, the obvious choice is semantic versioning/semantic release which automatically increments a version ...
Read more >
Configuration - Semantic Release - GitBook
The Git tag format used by semantic-release to identify releases. The tag name is generated with Lodash template and will be compiled with...
Read more >
Avoid having version number in source code - Packaging
I like to release often. The downside: Many changes in the git repo are changes to the version number. How could I avoid...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found