Fix wget --post-file usage with temporary files for API calls
All checks were successful
Build and Release / build (push) Successful in 11s
All checks were successful
Build and Release / build (push) Successful in 11s
This commit is contained in:
@@ -105,9 +105,16 @@ jobs:
|
||||
|
||||
# Create release using Gitea API with wget
|
||||
echo "Creating new release..."
|
||||
RESPONSE=$(wget --header="Authorization: token $GITEA_TOKEN" \
|
||||
|
||||
# Create JSON payload in a temp file
|
||||
cat > /tmp/release.json << 'PAYLOAD'
|
||||
{"tag_name":"TAG_PLACEHOLDER","name":"Release TAG_PLACEHOLDER","draft":false,"prerelease":false}
|
||||
PAYLOAD
|
||||
sed -i "s/TAG_PLACEHOLDER/$TAG/g" /tmp/release.json
|
||||
|
||||
RESPONSE=$(wget --post-file=/tmp/release.json \
|
||||
--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")
|
||||
|
||||
@@ -129,10 +136,9 @@ jobs:
|
||||
filename=$(basename "$file")
|
||||
echo " Uploading: $filename"
|
||||
|
||||
# Use wget to upload binary data to Gitea API
|
||||
UPLOAD_RESPONSE=$(wget --header="Authorization: token $GITEA_TOKEN" \
|
||||
--method=POST \
|
||||
--body-file="$file" \
|
||||
# Upload binary file to Gitea API
|
||||
UPLOAD_RESPONSE=$(wget --post-file="$file" \
|
||||
--header="Authorization: token $GITEA_TOKEN" \
|
||||
--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)
|
||||
|
||||
Reference in New Issue
Block a user