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:
RemoteHvcsBase
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
- 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, assets: list[str] | None = None) 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
- 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_changelog_context_filters() tuple[Callable[..., Any], ...] [source]¶
Return a list of functions that can be used as filters in a Jinja2 template
ex. filters to convert text to URLs for issues and commits
- 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
- remote_url(use_token: bool = True) str [source]¶
Get the remote url including the token for authentication if requested
- 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
- upload_release_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