devops.release.version

Resolve the release version from the release branch or hotfix PR title.

Functions

check_version_format(version, config)

Fail unless the version is <prefix>X.Y.Z.

resolve_version(head_ref, title, *, prepare, ...)

Return the release tag for a release or hotfix pull request.

devops.release.version.check_version_format(version, config)[source]

Fail unless the version is <prefix>X.Y.Z.

Parameters:
  • version (str) – The release tag, for example v1.2.3.

  • config (GitConfig) – The Git configuration with the tag prefix.

Raises:

ReleaseError – If the version does not use the configured format.

Return type:

None

devops.release.version.resolve_version(head_ref, title, *, prepare, config)[source]

Return the release tag for a release or hotfix pull request.

A release branch is release/<prefix>X.Y.Z and its PR title must be Release-X.Y.Z. A hotfix branch is hotfix/<name> and its PR title must start with Hotfix-X.Y.Z.

Parameters:
  • head_ref (str) – The source branch of the pull request.

  • title (str | None) – The pull request title. None skips the release title check.

  • prepare (bool) – Also check that the tag is new and that a hotfix follows the latest tag. Use it before the release; leave it off after the merge.

  • config (GitConfig) – The Git configuration with the tag prefix.

Returns:

str – The release tag, for example v1.2.3.

Raises:

ReleaseError – If the branch, title or version is not valid for a release.

Return type:

str