diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index ab95cf4..be15fd3 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -103,15 +103,15 @@ jobs: echo "Creating release for tag: $TAG" echo "Repository: $REPO_OWNER/$REPO_NAME" - # Create release using Gitea API + # Create release using Gitea API with wget echo "Creating new release..." - RESPONSE=$(curl -s -X POST \ - -H "Authorization: token $GITEA_TOKEN" \ - -H "Content-Type: application/json" \ - -d "{\"tag_name\":\"$TAG\",\"name\":\"Release $TAG\",\"draft\":false,\"prerelease\":false}" \ + RESPONSE=$(wget --header="Authorization: token $GITEA_TOKEN" \ + --header="Content-Type: application/json" \ + --post-data="{\"tag_name\":\"$TAG\",\"name\":\"Release $TAG\",\"draft\":false,\"prerelease\":false}" \ + -O - -q \ "$GITEA_URL/api/v1/repos/$REPO_OWNER/$REPO_NAME/releases") - # Extract release ID using grep instead of jq + # Extract release ID using grep RELEASE_ID=$(echo "$RESPONSE" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*') if [ -z "$RELEASE_ID" ]; then @@ -129,18 +129,19 @@ jobs: filename=$(basename "$file") echo " Uploading: $filename" - UPLOAD_RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \ - -H "Authorization: token $GITEA_TOKEN" \ - -F "attachment=@$file" \ - "$GITEA_URL/api/v1/repos/$REPO_OWNER/$REPO_NAME/releases/$RELEASE_ID/assets") + # Use wget to upload binary data to Gitea API + UPLOAD_RESPONSE=$(wget --header="Authorization: token $GITEA_TOKEN" \ + --method=POST \ + --body-file="$file" \ + --header="Content-Type: application/octet-stream" \ + -O - -q \ + "$GITEA_URL/api/v1/repos/$REPO_OWNER/$REPO_NAME/releases/$RELEASE_ID/assets?name=$filename" 2>&1) - HTTP_CODE=$(echo "$UPLOAD_RESPONSE" | tail -n 1) - - if [ "$HTTP_CODE" = "201" ] || [ "$HTTP_CODE" = "200" ]; then - echo " ✓ $filename uploaded (HTTP $HTTP_CODE)" + if echo "$UPLOAD_RESPONSE" | grep -q '"id"'; then + echo " ✓ $filename uploaded" else - echo " ✗ Failed to upload $filename (HTTP $HTTP_CODE)" - echo "Response: $(echo "$UPLOAD_RESPONSE" | head -n -1)" + echo " ✗ Failed to upload $filename" + echo "Response: $UPLOAD_RESPONSE" fi fi done