R3
Rolling release / release (push) Successful in 6m16s
CI / verify (push) Successful in 3m51s

This commit is contained in:
2026-09-11 15:05:56 -04:00
parent d1f339170e
commit 9712bed6f3
2 changed files with 16 additions and 10 deletions
+10 -8
View File
@@ -7,7 +7,8 @@ set -euo pipefail
: "${RELEASE_TOKEN:?RELEASE_TOKEN is required}"
API="${GITEA_SERVER_URL%/}/api/v1/repos/${GITEA_REPOSITORY}"
AUTH=(-H "Authorization: token ${RELEASE_TOKEN}" -H 'Accept: application/json' -H 'Content-Type: application/json')
AUTH=(-H "Authorization: token ${RELEASE_TOKEN}" -H 'Accept: application/json')
JSON=(-H 'Content-Type: application/json')
TAG="rolling"
release_json="$(curl -fsS "${AUTH[@]}" "${API}/releases/tags/${TAG}" 2>/dev/null || true)"
@@ -18,15 +19,16 @@ if [[ -n "${release_json}" ]]; then
fi
fi
tag_payload="$(jq -nc --arg sha "${GITEA_SHA}" '{new_target:$sha, force:true}')"
if ! curl -fsS -X PATCH "${AUTH[@]}" "${API}/git/refs/tags/${TAG}" --data "${tag_payload}" >/dev/null 2>&1; then
create_tag="$(jq -nc --arg sha "${GITEA_SHA}" --arg ref "refs/tags/${TAG}" '{ref:$ref, sha:$sha}')"
curl -fsS -X POST "${AUTH[@]}" "${API}/git/refs" --data "${create_tag}" >/dev/null
fi
# This Gitea instance exposes tag replacement through the repository tag API;
# it does not implement PATCH /git/refs/{ref}.
curl -fsS -X DELETE "${AUTH[@]}" "${API}/tags/${TAG}" >/dev/null 2>&1 || true
tag_payload="$(jq -nc --arg sha "${GITEA_SHA}" --arg tag "${TAG}" \
'{tag_name:$tag, target:$sha, message:"Automated rolling tag"}')"
curl -fsS -X POST "${AUTH[@]}" "${JSON[@]}" "${API}/tags" --data "${tag_payload}" >/dev/null
release_payload="$(jq -nc --arg tag "${TAG}" --arg sha "${GITEA_SHA}" \
'{tag_name:$tag, target_commitish:$sha, name:("Rolling " + ($sha[0:12])), body:"Automated Gitea rolling release from main.", draft:false, prerelease:true}')"
created="$(curl -fsS -X POST "${AUTH[@]}" "${API}/releases" --data "${release_payload}")"
created="$(curl -fsS -X POST "${AUTH[@]}" "${JSON[@]}" "${API}/releases" --data "${release_payload}")"
release_id="$(jq -r '.id // empty' <<<"${created}")"
test -n "${release_id}"
@@ -34,6 +36,6 @@ for asset in dist/jarvis-qvac_*.deb dist/jarvis-qvac-extension.zip dist/SHA256SU
[[ -f "${asset}" ]] || continue
curl -fsS -X POST "${AUTH[@]}" \
"${API}/releases/${release_id}/assets?name=$(basename "${asset}")" \
-H 'Content-Type: application/octet-stream' --data-binary "@${asset}" >/dev/null
-F "attachment=@${asset}" >/dev/null
done
echo "Published Gitea rolling release ${TAG} for ${GITEA_SHA:0:12}"