Replace curl with wget in CI/CD workflow for Gitea runner compatibility

This commit is contained in:
Ducky SSH User
2025-12-20 06:31:02 +00:00
parent 999a595b9c
commit 3a7b5a0f9a

View File

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