def test_current_version_should_return_git_version(mock_last_version): assert "last_version" == get_current_version_by_tag()
def assert_releaseable_changes_detected(current_tagged_version): bump_string = evaluate_version_bump(current_tagged_version) assert bump_string, "semantic-release would not create a release!" return bump_string def commit_and_tag_pyproject_toml(bump_string, old_version, new_version): tag_message = f"Creating {bump_string} release. Bumping version number from {old_version} to {new_version}." commit_message = f"build(version): {tag_message}" tag_name = f"v{new_version}" repository = git.Repo(PROJECT_ROOT_PATH) repository.index.add([PYPROJECT_TOML_PATH]) repository.index.commit(commit_message) repository.create_tag(tag_name, tag_message) assert_clean_main() pyproject_toml = get_current_project_version() current_project_version = pyproject_toml["tool"]["poetry"]["version"] assert_current_project_version_semver(current_project_version) enable_semantic_release_logging() current_tagged_version = get_current_version_by_tag() bump_string = assert_releaseable_changes_detected(current_tagged_version) new_version = get_new_version(current_tagged_version, bump_string) print( f"Creating {bump_string} release! Bumping from version {current_tagged_version} to version {new_version}!" ) pyproject_toml["tool"]["poetry"]["version"] = new_version set_current_project_version(pyproject_toml) commit_and_tag_pyproject_toml(bump_string, current_tagged_version, new_version)