semantic_release.hvcs.gitea module#

Helper code for interacting with a Gitea remote VCS

class semantic_release.hvcs.gitea.Gitea(remote_url: str, *, hvcs_domain: str | None = None, token: str | None = None, allow_insecure: bool = False, **kwargs: Any)[source]#

Bases: HvcsBase

Gitea helper class

DEFAULT_API_PATH = '/api/v1'#
DEFAULT_DOMAIN = 'gitea.com'#
DEFAULT_ENV_TOKEN_NAME = 'GITEA_TOKEN'#
asset_upload_url(release_id: str) str[source]#

Get the correct upload url for a release https://gitea.com/api/swagger#/repository/repoCreateReleaseAttachment :param release_id: ID of the release to upload to

commit_hash_url(commit_hash: str) str[source]#

Given a commit hash, return a web URL which links to this commit in the remote VCS.

create_api_url(endpoint: str, auth: str | None = None, query: str | None = None, fragment: str | None = None) str[source]#
create_or_update_release(tag: str, release_notes: str, prerelease: bool = False) int[source]#

Post release changelog :param version: The version number :param changelog: The release notes for this version :return: The status of the request

create_release(tag: str, release_notes: str, prerelease: bool = False) int[source]#

Create a new release

Ref: https://gitea.com/api/swagger#/repository/repoCreateRelease

Parameters:
  • tag – Tag to create release for

  • release_notes – The release notes for this version

  • prerelease – Whether or not this release should be specified as a

prerelease

Returns:

Whether the request succeeded

create_server_url(path: str, auth: str | None = None, query: str | None = None, fragment: str | None = None) str[source]#
edit_release_notes(release_id: int, release_notes: str) int[source]#

Edit a release with updated change notes https://gitea.com/api/swagger#/repository/repoEditRelease :param id: ID of release to update :param release_notes: The release notes for this version :return: The ID of the release that was edited

get_release_id_by_tag(tag: str) int | None[source]#

Get a release by its tag name https://gitea.com/api/swagger#/repository/repoGetReleaseByTag :param tag: Tag to get release for :return: ID of found release

pull_request_url(pr_number: str | int) str[source]#

Given a number for a PR/Merge request/equivalent, return a web URL that links to that PR in the remote VCS.

remote_url(use_token: bool = True) str[source]#

Get the remote url including the token for authentication if requested

upload_asset(release_id: int, file: str, label: str | None = None) bool[source]#

Upload an asset to an existing release https://gitea.com/api/swagger#/repository/repoCreateReleaseAttachment :param release_id: ID of the release to upload to :param file: Path of the file to upload :param label: this parameter has no effect :return: The status of the request

upload_dists(tag: str, dist_glob: str) int[source]#

Upload distributions to a release :param tag: Tag to upload for :param path: Path to the dist directory :return: The number of distributions successfully uploaded