Skip to content

publish_release.py

Bump version, create tag and create release.

publish_release(provider, pr_number)

Publish a release based on the pull request changelog.

Parameters

provider The GitProvider instance to interact with the git provider.

pr_number The pull request number to create a release for.

Notes

Bumps the version, creates a tag, and publishes a release using the PR body as changelog.

Source code in taglyatelle/background_commands/publish_release.py
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
def publish_release(provider: GitProvider, pr_number: int) -> None:
    """
    Publish a release based on the pull request changelog.

    Parameters
    ----------
    provider
        The GitProvider instance to interact with the git provider.

    pr_number
        The pull request number to create a release for.

    Notes
    -----
    Bumps the version, creates a tag, and publishes a release using the PR body as changelog.
    """

    changelog = provider.get_pr_body(pr_number)
    new_version = _bump_version(provider, changelog)
    provider.create_tag(tag=new_version)
    provider.create_release(body=changelog)
    logger.info(f"Created release {new_version} for PR #{pr_number}")