fix: use printf for JSON body and Authorization header for Gitea API
Release / build-and-release (push) Failing after 56s

This commit is contained in:
datadunia
2026-05-08 04:03:52 +07:00
parent 64e8372fc1
commit 4a3d099ff9
+8 -7
View File
@@ -63,19 +63,20 @@ jobs:
- name: Create Release and upload assets
run: |
TOKEN="${{ secrets.TOKEN_BUILD }}"
API="${{ gitea.server_url }}/api/v1"
REPO="${{ gitea.repository }}"
TAG="${{ gitea.ref_name }}"
API="https://git.datadunia.com/api/v1"
JSON_BODY=$(printf '{"tag_name":"%s","name":"%s","body":"Release %s","draft":false,"prerelease":false}' "$TAG" "$TAG" "$TAG")
RELEASE_RESP=$(curl -s -X POST \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"body\":\"Release $TAG\",\"draft\":false,\"prerelease\":false}" \
"$API/repos/$REPO/releases?token=$TOKEN")
-d "$JSON_BODY" \
"$API/repos/$REPO/releases")
echo "Release response: $RELEASE_RESP"
RELEASE_ID=$(echo "$RELEASE_RESP" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*')
echo "Release ID: $RELEASE_ID"
if [ -z "$RELEASE_ID" ]; then
echo "Failed to create release"
exit 1
@@ -84,9 +85,9 @@ jobs:
for FILE in wgrplane-linux-amd64 wgrplane-linux-arm64 latest.json; do
echo "Uploading $FILE..."
curl -s -X POST \
-H "Authorization: token $TOKEN" \
-F "attachment=@$FILE" \
"$API/repos/$REPO/releases/$RELEASE_ID/assets?name=$FILE&token=$TOKEN"
echo ""
"$API/repos/$REPO/releases/$RELEASE_ID/assets?name=$FILE"
done
- name: Cleanup build artifacts