semantic_release.vcs_helpers module

VCS Helpers

semantic_release.vcs_helpers.checkout(branch: str)[source]

Check out the given branch in the local repository.

Parameters

branch – The branch to checkout.

semantic_release.vcs_helpers.commit_new_version(version: str)[source]

Commit the file containing the version number variable.

The commit message will be generated from the configured template.

Parameters

version – Version number to be used in the commit message.

semantic_release.vcs_helpers.get_changed_files(repo: git.repo.base.Repo) List[str][source]

Get untracked / dirty files in the given git repo().

Parameters

repo – Git repo to check.

Returns

A list of filenames.

semantic_release.vcs_helpers.get_commit_log(from_rev=None)[source]

Yield all commit messages from last to first.

semantic_release.vcs_helpers.get_current_head_hash() str[source]

Get the commit hash of the current HEAD.

Returns

The commit hash.

semantic_release.vcs_helpers.get_formatted_commit(version: str) str[source]
semantic_release.vcs_helpers.get_formatted_tag(version)[source]

Get the version, formatted with tag_format config option

semantic_release.vcs_helpers.get_last_version(pattern, skip_tags=None) Optional[str][source]

Find the latest version using repo tags.

Returns

A string containing a version number.

semantic_release.vcs_helpers.get_repository_owner_and_name() Tuple[str, str][source]

Check the ‘origin’ remote to get the owner and name of the remote repository.

Returns

A tuple of the owner and name.

semantic_release.vcs_helpers.push_new_version(auth_token: str = None, owner: str = None, name: str = None, branch: str = 'master', domain: str = 'github.com')[source]

Run git push and git push –tags.

Parameters
  • auth_token – Authentication token used to push.

  • owner – Organisation or user that owns the repository.

  • name – Name of repository.

  • branch – Branch to push to

  • server_url – Name of the server. Will be used to identify a gitlab instance.

Raises

GitError – if GitCommandError is raised

semantic_release.vcs_helpers.repo()[source]
semantic_release.vcs_helpers.tag_new_version(version: str)[source]

Create a new tag with the version number, prefixed with v by default.

Parameters

version – The version number used in the tag as a string.

semantic_release.vcs_helpers.update_additional_files()[source]

Add specified files to VCS, if they’ve changed.

semantic_release.vcs_helpers.update_changelog_file(version: str, content_to_add: str)[source]

Update changelog file with changelog for the release.

Parameters
  • version – The release version number, as a string.

  • content_to_add – The release notes for the version.