From b8ee8be9ebbdc948191cf138d5c929a8f3a97d3c Mon Sep 17 00:00:00 2001 From: Sanders Date: Wed, 12 Aug 2026 01:17:31 +0300 Subject: [PATCH] =?UTF-8?q?Create=20release=20tags=20via=20POST=20/tags=20?= =?UTF-8?q?=E2=80=94=20Gitea=20has=20no=20POST=20/git/refs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit POST /git/refs returns 405 with an empty body on Gitea, which crashed the tag step (json decode of ''). Use the tags API: POST /repos/{owner}/{repo}/tags with {tag_name, target} (201), and 409 'tag already exists' is handled gracefully. --- .gitea/workflows/build-apk.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/build-apk.yml b/.gitea/workflows/build-apk.yml index f5f6db5..dcf6775 100644 --- a/.gitea/workflows/build-apk.yml +++ b/.gitea/workflows/build-apk.yml @@ -144,15 +144,16 @@ jobs: API="${{ github.api_url }}/repos/${GITHUB_REPOSITORY}" TAG_COMMIT=$(git rev-parse HEAD) echo "== Creating tag v${NEXT_VERSION} at ${TAG_COMMIT} ==" - TAG_RESP=$(curl -sS -X POST "$API/git/refs" \ + # Gitea has no POST /git/refs (405); use the tags API instead. + TAG_RESP=$(curl -sS -X POST "$API/tags" \ -H "Authorization: token $GITHUB_TOKEN" \ -H "Content-Type: application/json" \ - -d "{\"ref\":\"refs/tags/v${NEXT_VERSION}\",\"sha\":\"${TAG_COMMIT}\"}") + -d "{\"tag_name\":\"v${NEXT_VERSION}\",\"target\":\"${TAG_COMMIT}\"}") echo "$TAG_RESP" | python3 -c " import json, sys d = json.load(sys.stdin) - if 'ref' in d: - print(' tag created: ' + d['ref']) + if 'name' in d: + print(' tag created: ' + d['name']) elif 'message' in d and 'already' in str(d['message']).lower(): print(' tag already exists: ' + str(d['message'])) else: