ci(release): authenticate Forgejo API with HTTP Basic

Bearer is rejected on this instance (403/1010). Use sirius + token, matching
the dispatch path that actually works.
This commit is contained in:
agent 2026-09-13 15:27:57 -04:00
commit dc52df2366
No known key found for this signature in database
3 changed files with 11 additions and 11 deletions

View file

@ -21,7 +21,7 @@ api_curl() {
}
auth_json() {
api_curl -H "Authorization: Bearer ${FORGEJO_TOKEN}" -H "Content-Type: application/json" "$@"
api_curl -u "sirius:${FORGEJO_TOKEN}" -H "Content-Type: application/json" "$@"
}
tag="${1:?usage: publish-release.sh <tag> <name> <body-file> <asset>...}"
@ -109,7 +109,7 @@ for f in "$@"; do
fi
asset=$(basename "$f")
echo "publish: asset $asset is $bytes bytes on disk"
api_curl -H "Authorization: Bearer ${FORGEJO_TOKEN}" "$api/releases/$rid/assets" \
api_curl -u "sirius:${FORGEJO_TOKEN}" "$api/releases/$rid/assets" \
| python3 -c "
import json,sys
for a in json.load(sys.stdin):
@ -118,7 +118,7 @@ for a in json.load(sys.stdin):
if [ "$aname" = "$asset" ]; then
echo "publish: deleting stale asset $aname ($aid)"
del=$(api_curl -o /tmp/release-adel.json -w '%{http_code}' \
-X DELETE -H "Authorization: Bearer ${FORGEJO_TOKEN}" \
-X DELETE -u "sirius:${FORGEJO_TOKEN}" \
"$api/releases/$rid/assets/$aid")
if [ "$del" != "204" ] && [ "$del" != "404" ]; then
die_http "DELETE asset $aid" "$del" /tmp/release-adel.json
@ -127,7 +127,7 @@ for a in json.load(sys.stdin):
done
up=$(api_curl -o /tmp/release-asset.json -w '%{http_code}' \
-X POST "$api/releases/$rid/assets?name=$asset" \
-H "Authorization: Bearer ${FORGEJO_TOKEN}" \
-u "sirius:${FORGEJO_TOKEN}" \
-F "attachment=@$f")
if [ "$up" != "201" ]; then
die_http "upload $asset" "$up" /tmp/release-asset.json
@ -142,7 +142,7 @@ if not size:
"
done
api_curl -H "Authorization: Bearer ${FORGEJO_TOKEN}" "$api/releases/$rid/assets" \
api_curl -u "sirius:${FORGEJO_TOKEN}" "$api/releases/$rid/assets" \
| python3 -c "
import json,sys
for a in json.load(sys.stdin):