GRM-54: Integrate tea Gitea CLI for API interactions (#68)

This commit is contained in:
2026-06-22 07:04:58 +00:00
parent b8ab4f854b
commit 28e61aa166
17 changed files with 1319 additions and 265 deletions
+6 -18
View File
@@ -2,6 +2,7 @@
"""Build package, optionally publish to PyPI, and create Gitea release.
Uses git-cliff to generate the release notes from conventional commits.
Uses the ``tea`` Gitea CLI for release creation.
Usage:
REPO_TOKEN=<token> [PYPI_TOKEN=<token>] python3 scripts/publish.py <tag> <repo>
@@ -15,10 +16,8 @@ import sys
import click
from dotenv import load_dotenv # pyright: ignore[reportMissingImports,reportUnknownVariableType]
from gitea_runner_manager.api_clients import GiteaClient
from gitea_runner_manager.config import GITEA_API_URL
from gitea_runner_manager.exceptions import APIError
from gitea_runner_manager.i18n import _
from scripts.gitea_cli import TeaCLI, TeaCLIError
load_dotenv(override=True)
@@ -109,24 +108,13 @@ def main(tag: str, repo: str) -> None:
else:
click.echo(_("PYPI_TOKEN not set — skipping PyPI publish. No worries, we'll just create the Gitea release."))
owner, repo_name = repo.split("/")
client = GiteaClient(GITEA_API_URL, gitea_token, owner, repo_name)
tea = TeaCLI(repo=repo)
release_body = generate_release_notes(tag)
try:
client.create_release_idempotent(
tag=tag,
body=release_body,
)
except APIError as e:
raise click.ClickException(
_(
"Release creation failed with HTTP {status}: {message}",
status=e.status,
message=e.message,
)
) from None
tea.create_release(repo, tag=tag, title=tag, body=release_body)
except TeaCLIError as e:
raise click.ClickException(_("Release creation failed: {error}", error=str(e))) from None
click.echo(
_(