From d853e30d582673ccf9adeb1476313bb8be16a0b9 Mon Sep 17 00:00:00 2001 From: Michal Date: Sun, 8 Mar 2026 17:47:44 +0000 Subject: [PATCH] fix: verify package-repo linking after RPM publish Check via Gitea API whether the uploaded package is linked to the repository and warn with manual linking URL if not (Gitea 1.22 has no API for automated linking). Co-Authored-By: Claude Opus 4.6 --- scripts/publish-rpm.sh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/scripts/publish-rpm.sh b/scripts/publish-rpm.sh index 2be80f4..ba6ca9f 100755 --- a/scripts/publish-rpm.sh +++ b/scripts/publish-rpm.sh @@ -12,6 +12,7 @@ fi GITEA_URL="${GITEA_URL:-http://10.0.0.194:3012}" GITEA_OWNER="${GITEA_OWNER:-michal}" +GITEA_REPO="${GITEA_REPO:-mcpctl}" if [ -z "$GITEA_TOKEN" ]; then echo "Error: GITEA_TOKEN not set. Add it to .env or export it." @@ -49,7 +50,22 @@ curl --fail -s -X PUT \ echo "" echo "==> Published successfully!" + +# Verify the package is linked to the repo (Gitea stores the link at package level) +REPO_LINK=$(curl -s -H "Authorization: token ${GITEA_TOKEN}" \ + "${GITEA_URL}/api/v1/packages/${GITEA_OWNER}/rpm/mcpctl/${RPM_VERSION}" \ + | python3 -c "import json,sys; d=json.load(sys.stdin); r=d.get('repository'); print(r.get('full_name') if r else '')" 2>/dev/null) + +if [ -n "$REPO_LINK" ]; then + echo "==> Linked to repo: ${REPO_LINK}" +else + echo "" + echo "WARNING: Package is not linked to a repository." + echo "Link it manually in the Gitea UI:" + echo " ${GITEA_URL}/${GITEA_OWNER}/-/packages/rpm/mcpctl/${RPM_VERSION}/settings" + echo " → Link to repository: ${GITEA_OWNER}/${GITEA_REPO}" +fi + echo "" echo "Install with:" -echo " sudo dnf config-manager --add-repo ${GITEA_URL}/api/packages/${GITEA_OWNER}/rpm.repo" -echo " sudo dnf install mcpctl" +echo " sudo dnf install mcpctl # if repo already configured"