Skip to main content

ensure_release

Function ensure_release 

Source
pub fn ensure_release(
    token: &str,
    repo: &Repo,
    tag: &str,
    name: &str,
    body: &str,
    sha: &str,
    upload: PackageUpload,
) -> Result<String>
Expand description

Create tag at sha if it is missing. Returns the release HTML URL.

A new Release is a Stage::Stable one, with GitHub’s defaults, and is published at once. An existing release is used as it is, and a draft found is published.

An existing release is not trusted: GitHub’s target_commitish on the Release object is a branch name more often than a SHA. The git ref is re-read either way, and a tag that names another commit fails.

§Errors

Returns an error when:

  • The GitHub client cannot be built.
  • A release or tag lookup fails.
  • The release cannot be created, or a draft found cannot be published.
  • The tag does not point at sha.

The tag is checked against an existing release only when upload is PackageUpload::Shipped.