From b95c61118b1bca8bb8a0078364c48dc23d2690ef Mon Sep 17 00:00:00 2001 From: Manuel Weiser Date: Fri, 21 Feb 2025 23:37:12 +0100 Subject: [PATCH] workflow: update Gitea release workflow to use file uploads with curl --- .github/workflows/gitea-release.yml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/gitea-release.yml b/.github/workflows/gitea-release.yml index 53ae7a1..5113414 100644 --- a/.github/workflows/gitea-release.yml +++ b/.github/workflows/gitea-release.yml @@ -124,7 +124,7 @@ jobs: FILES="" for file in upgrade_filaman_firmware_v${VERSION}.bin upgrade_filaman_website_v${VERSION}.bin filaman_full_${VERSION}.bin; do if [ -f "$file" ]; then - FILES="$FILES -a $file" + FILES="$FILES -F \"attach[]=@$file\"" echo "Debug: Found file: $file" fi done @@ -143,19 +143,18 @@ jobs: # Create release using API echo "Debug: Creating release..." - RELEASE_DATA="{ - \"tag_name\": \"v${VERSION}\", - \"name\": \"v${VERSION}\", - \"body\": \"${{ steps.changelog.outputs.CHANGES }}\" - }" + RELEASE_DATA="{\"tag_name\":\"v${VERSION}\",\"name\":\"v${VERSION}\",\"body\":\"${{ steps.changelog.outputs.CHANGES }}\"}" - # Create release with explicit token header - RESPONSE=$(curl -s -w "\n%{http_code}" \ + # Create release with explicit token header and file uploads + CURL_CMD="curl -s -w \"\n%{http_code}\" \ -X POST \ - -H "Authorization: token ${GITEA_TOKEN}" \ - -H "Content-Type: application/json" \ - -d "$RELEASE_DATA" \ - "${GITEA_API_URL}/api/v1/repos/${GITEA_OWNER}/${GITEA_REPO}/releases") + -H \"Authorization: token ${GITEA_TOKEN}\" \ + -H \"Content-Type: application/json\" \ + -d '${RELEASE_DATA}' \ + ${FILES} \ + \"${GITEA_API_URL}/api/v1/repos/${GITEA_OWNER}/${GITEA_REPO}/releases\"" + + RESPONSE=$(eval $CURL_CMD) HTTP_STATUS=$(echo "$RESPONSE" | tail -n1) RESPONSE_BODY=$(echo "$RESPONSE" | head -n -1)