Skip to content
Joseph Manley edited this page Aug 20, 2019 · 7 revisions

Welcome to the auto-semver wiki!

  1. Getting Started
  2. Commands
  3. .bumpversion.cfg
  4. VERSION file

Getting Started

Installing Auto-SemVer

  1. Download the latest tar.gz

  2. Run pip install on the file.

    pip install auto-semver1.0.8.tar.gz

  3. Validate your install was successful

    semver -h

Commands

semver

The semver command runs auto-semver.

The exit code of auto-semver determines the output.

Exit codes:

Value Meaning
0 Successfully ran auto-semver
1 No merge found
2 Not a main branch
3 No git flow branch name found
128 Unknown error occured

Flags

-n

Does not push after versioning.

-h

Shows helps screen.

semver_get_version

The semver_get_version command returns the version number if the semver command exited 0. If semver exited anything else, semver_get_version will return the branch name.

Flags

-d

Replaces / with . in branch names. For example, feature/test becomes feature.test

.bumpversion.cfg

The .bumpversion.cfg file determines auto-semver's output and how it interacts with other files.

The [bumpversion] section has values that determines the current version and how bumpversion interacts with Git.

Any [bumpversion:file:*] section is for a file in which bumpversion will keep a copy of the version.

See more on how bumpversion works on GitHub

semver

The [semver] section has keys corresponding to branches that determine versioning.

The main_branches are the branches in which versioning takes places.

The major_branches determine the first number in the version. (x in x.0.0)

The minor_branches determine the second number in the version. (x in 0.x.0)

The patch_branches determine the last number in the version. (x in 0.0.x)

Example

Example .bumpversion.cfg:

[bumpversion]
current_version = 0.0.0
commit = True
tag = True
tag_name = {new_version}
message = Bump version: {current_version} -> {new_version}

[bumpversion:file:VERSION]
search = __version__ = {current_version}
replace = __version__ = {new_version}

[semver]
main_branches = develop
major_branches = 
minor_branches = feature
patch_branches = bugfix, hotfix

Example VERSION:

__version__ = 0.0.0
Clone this wiki locally