Python semver.bump_minor() Examples

The following are 6 code examples of semver.bump_minor(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module semver , or try the search function .
Example #1
Source File: version-update.py    From gitlab-semantic-versioning with Apache License 2.0 6 votes vote down vote up
def bump(latest):

    minor_bump_label = os.environ.get("MINOR_BUMP_LABEL") or "bump-minor"
    major_bump_label = os.environ.get("MAJOR_BUMP_LABEL") or "bump-major"

    merge_request_id = extract_merge_request_id_from_commit()
    labels = retrieve_labels_from_merge_request(merge_request_id)



    if minor_bump_label in labels:
        return semver.bump_minor(latest)
    elif major_bump_label in labels:
        return semver.bump_major(latest)
    else:
        return semver.bump_patch(latest) 
Example #2
Source File: release.py    From serum with MIT License 5 votes vote down vote up
def increment_version(version, release_type):
    if release_type == 'major':
        return semver.bump_major(version)
    elif release_type == 'minor':
        return semver.bump_minor(version)
    return semver.bump_patch(version) 
Example #3
Source File: test_check.py    From chaostoolkit with Apache License 2.0 5 votes vote down vote up
def test_version_is_newer(requests):
    version = __version__.replace("rc", "-rc")
    newer_version = semver.bump_minor(version)
    requests.get.return_value = FakeResponse(
        200,
        "http://someplace//usage/latest/",
        {"version": __version__, "up_to_date": False}
    )

    latest_version = check_newer_version(command="init")
    assert latest_version == __version__ 
Example #4
Source File: version.py    From st2 with Apache License 2.0 5 votes vote down vote up
def version_bump_minor(value):
    return semver.bump_minor(value) 
Example #5
Source File: utils.py    From integrations-core with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def get_bump_function(changelog_types):
    minor_bump = False

    for changelog_type in changelog_types:
        bump_function = VERSION_BUMP.get(changelog_type)
        if bump_function is semver.bump_major:
            return bump_function
        elif bump_function is semver.bump_minor:
            minor_bump = True

    return semver.bump_minor if minor_bump else semver.bump_patch 
Example #6
Source File: release.py    From tandem with Apache License 2.0 4 votes vote down vote up
def main():
    if len(sys.argv) < 2:
        error("Pass in plugin type as the first argument. "
              "Choose from: {}".format(PLUGIN_TYPES))
    elif len(sys.argv) < 3:
        error("You must also pass in repository SHA as the argument")

    repo_type = sys.argv[1].lower()
    if repo_type == "sublime":
        repo_url = SUBLIME_REPO
    elif repo_type == "vim":
        repo_url = VIM_REPO
    elif repo_type == "nvim":
        repo_url = NVIM_REPO
    else:
        error("Please pass in one of {} as the plugin type"
              .format(PLUGIN_TYPES))

    master_SHA = sys.argv[2]

    bot_username = os.environ.get("RELEASE_BOT_USERNAME")
    bot_password = os.environ.get("RELEASE_BOT_PASSWORD")

    g = Github(bot_username, bot_password)

    release_repo = None
    for repo in g.get_organization(ORG_NAME).get_repos():
        if repo.html_url == repo_url:
            release_repo = repo
            break

    if release_repo is None:
        error("{} repo not found".format(repo_type))

    tags = release_repo.get_tags()
    last_tag = None
    for t in tags:
        last_tag = t
        break

    if (last_tag is None):
        last_tag = '0.0.0'
    else:
        if last_tag.commit.sha == master_SHA:
            error("Cannot create release with same SHA")
        last_tag = last_tag.name

    tag = semver.bump_minor(last_tag)

    release_repo.create_git_tag_and_release(
        tag,
        "Release version {}".format(tag),
        "v{}".format(tag),
        "Release version {}".format(tag),
        master_SHA,
        "commit",
    )

    print("Succesfully created release v{}".format(tag))