devops.release.publish

Tag the release commit and publish its GitHub release, safe to re-run.

Functions

get_release(client, repository, version)

Return the GitHub release of a tag, or None if it does not exist.

publish_release(client, repository, version)

Tag HEAD and publish a stable GitHub release with generated notes.

push_tag(version, target)

Create the tag on the release commit if needed and push it.

verify_release(release, version)

Fail unless the release is a published, stable release of the tag.

devops.release.publish.get_release(client, repository, version)[source]

Return the GitHub release of a tag, or None if it does not exist.

Parameters:
  • client (GitHubClient) – The GitHub client.

  • repository (str) – The repository as owner/name.

  • version (str) – The release tag.

Returns:

dict[str, Any] | None – The release, or None if GitHub has no release for the tag.

Raises:

ReleaseError – If GitHub returns something other than a release object.

Return type:

dict[str, Any] | None

devops.release.publish.verify_release(release, version)[source]

Fail unless the release is a published, stable release of the tag.

Parameters:
  • release (Any) – The release returned by GitHub.

  • version (str) – The release tag.

Raises:

ReleaseError – If the release is a draft, a pre-release, unpublished or another tag.

Return type:

None

devops.release.publish.push_tag(version, target)[source]

Create the tag on the release commit if needed and push it.

Parameters:
  • version (str) – The release tag.

  • target (str) – The release commit SHA.

Raises:

ReleaseError – If a local tag with this name points to another commit.

Return type:

None

devops.release.publish.publish_release(client, repository, version)[source]

Tag HEAD and publish a stable GitHub release with generated notes.

A re-run after a partial failure finishes the missing steps. An existing tag on another commit, or a release that is not published and stable, stops the run instead of being replaced.

Parameters:
  • client (GitHubClient) – The GitHub client.

  • repository (str) – The repository as owner/name.

  • version (str) – The release tag.

Returns:

str – The release commit SHA.

Raises:

ReleaseError – If the tag or release cannot be created or verified.

Return type:

str