Fix release script: use git remote repo and two-step asset upload.

Avoids wrong-repo releases when GITEA_REPO is set in the shell environment.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Bulk Renamer
2026-07-03 16:58:45 -05:00
co-authored by Cursor
parent 682e76de2f
commit b3ce276d1b
+16 -5
View File
@@ -11,6 +11,11 @@ cd "$(dirname "$0")"
GITEA_HOST="${GITEA_HOST:-https://git.hisora.dev}" GITEA_HOST="${GITEA_HOST:-https://git.hisora.dev}"
GITEA_OWNER="${GITEA_OWNER:-Dawnsorrow}" GITEA_OWNER="${GITEA_OWNER:-Dawnsorrow}"
if remote_url="$(git remote get-url origin 2>/dev/null)"; then
GITEA_REPO="$(basename "${remote_url%.git}")"
elif [[ -z "${GITEA_REPO:-}" ]]; then
GITEA_REPO="HS-Rename"
fi
GITEA_REPO="${GITEA_REPO:-HS-Rename}" GITEA_REPO="${GITEA_REPO:-HS-Rename}"
APP_IMAGE="HSRename.AppImage" APP_IMAGE="HSRename.AppImage"
@@ -60,13 +65,19 @@ Gear Lever update URL:
EOF EOF
)" )"
echo "=== Creating Gitea release $TAG ===" echo "=== Creating Gitea release $TAG on ${GITEA_OWNER}/${GITEA_REPO} ==="
curl -fsS -X POST "$API" \ RELEASE_JSON="$(curl -fsS -X POST "$API" \
-H "Authorization: token ${GITEA_TOKEN}" \ -H "Authorization: token ${GITEA_TOKEN}" \
-F "tag_name=${TAG}" \ -F "tag_name=${TAG}" \
-F "title=${TAG}" \ -F "name=${TAG}" \
-F "body=${NOTES}" \ -F "body=${NOTES}")"
-F "attachment=@${APP_IMAGE};filename=${APP_IMAGE}" RELEASE_ID="$(python3 -c "import json,sys; print(json.loads(sys.argv[1])['id'])" "$RELEASE_JSON")"
echo "=== Uploading ${APP_IMAGE} (${RELEASE_ID}) ==="
curl -fsS --max-time 300 -X POST \
"${API}/${RELEASE_ID}/assets?name=${APP_IMAGE}" \
-H "Authorization: token ${GITEA_TOKEN}" \
-F "attachment=@${APP_IMAGE}" >/dev/null
echo "" echo ""
echo "Release published:" echo "Release published:"