Fix wget --post-file usage with temporary files for API calls
This commit is contained in:
@@ -105,9 +105,16 @@ jobs:
|
|||||||
|
|
||||||
# Create release using Gitea API with wget
|
# Create release using Gitea API with wget
|
||||||
echo "Creating new release..."
|
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" \
|
--header="Content-Type: application/json" \
|
||||||
--post-data="{\"tag_name\":\"$TAG\",\"name\":\"Release $TAG\",\"draft\":false,\"prerelease\":false}" \
|
|
||||||
-O - -q \
|
-O - -q \
|
||||||
"$GITEA_URL/api/v1/repos/$REPO_OWNER/$REPO_NAME/releases")
|
"$GITEA_URL/api/v1/repos/$REPO_OWNER/$REPO_NAME/releases")
|
||||||
|
|
||||||
@@ -129,10 +136,9 @@ jobs:
|
|||||||
filename=$(basename "$file")
|
filename=$(basename "$file")
|
||||||
echo " Uploading: $filename"
|
echo " Uploading: $filename"
|
||||||
|
|
||||||
# Use wget to upload binary data to Gitea API
|
# Upload binary file to Gitea API
|
||||||
UPLOAD_RESPONSE=$(wget --header="Authorization: token $GITEA_TOKEN" \
|
UPLOAD_RESPONSE=$(wget --post-file="$file" \
|
||||||
--method=POST \
|
--header="Authorization: token $GITEA_TOKEN" \
|
||||||
--body-file="$file" \
|
|
||||||
--header="Content-Type: application/octet-stream" \
|
--header="Content-Type: application/octet-stream" \
|
||||||
-O - -q \
|
-O - -q \
|
||||||
"$GITEA_URL/api/v1/repos/$REPO_OWNER/$REPO_NAME/releases/$RELEASE_ID/assets?name=$filename" 2>&1)
|
"$GITEA_URL/api/v1/repos/$REPO_OWNER/$REPO_NAME/releases/$RELEASE_ID/assets?name=$filename" 2>&1)
|
||||||
|
|||||||
Reference in New Issue
Block a user