fix(ci): use curl instead of gh CLI for release creation
Build and Release / build-and-release (push) Failing after 4m16s
Build and Release / build-and-release (push) Failing after 4m16s
This commit is contained in:
@@ -77,19 +77,42 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
TAG: ${{ steps.version-check.outputs.TAG }}
|
||||
run: |
|
||||
API="https://api.github.com/repos/${{ github.repository }}"
|
||||
AUTH="Authorization: Bearer $GITHUB_TOKEN"
|
||||
|
||||
# Create release
|
||||
gh release create "$TAG" \
|
||||
--repo "${{ github.repository }}" \
|
||||
--title "$TAG" \
|
||||
--notes "Automated build for $TAG" \
|
||||
--latest
|
||||
RESPONSE=$(curl -s -X POST "$API/releases" \
|
||||
-H "$AUTH" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"tag_name\": \"$TAG\",
|
||||
\"name\": \"$TAG\",
|
||||
\"body\": \"Automated build for $TAG\",
|
||||
\"draft\": false,
|
||||
\"prerelease\": false
|
||||
}")
|
||||
|
||||
RELEASE_ID=$(echo "$RESPONSE" | jq -r '.id')
|
||||
UPLOAD_URL=$(echo "$RESPONSE" | jq -r '.upload_url' | sed 's/{?name,label}//')
|
||||
echo "Created release ID: $RELEASE_ID"
|
||||
|
||||
if [ "$RELEASE_ID" = "null" ] || [ -z "$RELEASE_ID" ]; then
|
||||
echo "Failed to create release:"
|
||||
echo "$RESPONSE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Upload all built artifacts
|
||||
for file in out/*.exe out/*.AppImage out/*.deb; do
|
||||
[ -f "$file" ] || continue
|
||||
FILENAME=$(basename "$file")
|
||||
MIME="application/octet-stream"
|
||||
echo "Uploading: $FILENAME ($(du -h "$file" | cut -f1))"
|
||||
gh release upload "$TAG" "$file" --repo "${{ github.repository }}"
|
||||
curl -s -X POST "${UPLOAD_URL}?name=${FILENAME}" \
|
||||
-H "$AUTH" \
|
||||
-H "Content-Type: $MIME" \
|
||||
--data-binary "@$file" \
|
||||
| jq -r '" -> \(.name) (\(.size) bytes)"'
|
||||
done
|
||||
|
||||
echo "All assets uploaded"
|
||||
|
||||
Reference in New Issue
Block a user