Compare commits
2 Commits
v0.0.32
...
e0b8f8650b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e0b8f8650b | ||
|
|
3a7b5a0f9a |
@@ -103,15 +103,22 @@ 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 \
|
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
# Create JSON payload in a temp file
|
||||||
-H "Content-Type: application/json" \
|
cat > /tmp/release.json << 'PAYLOAD'
|
||||||
-d "{\"tag_name\":\"$TAG\",\"name\":\"Release $TAG\",\"draft\":false,\"prerelease\":false}" \
|
{"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" \
|
||||||
|
-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 +136,18 @@ jobs:
|
|||||||
filename=$(basename "$file")
|
filename=$(basename "$file")
|
||||||
echo " Uploading: $filename"
|
echo " Uploading: $filename"
|
||||||
|
|
||||||
UPLOAD_RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
|
# Upload binary file to Gitea API
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
UPLOAD_RESPONSE=$(wget --post-file="$file" \
|
||||||
-F "attachment=@$file" \
|
--header="Authorization: token $GITEA_TOKEN" \
|
||||||
"$GITEA_URL/api/v1/repos/$REPO_OWNER/$REPO_NAME/releases/$RELEASE_ID/assets")
|
--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
|
||||||
|
|||||||
Reference in New Issue
Block a user