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 }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
TAG: ${{ steps.version-check.outputs.TAG }}
|
TAG: ${{ steps.version-check.outputs.TAG }}
|
||||||
run: |
|
run: |
|
||||||
|
API="https://api.github.com/repos/${{ github.repository }}"
|
||||||
|
AUTH="Authorization: Bearer $GITHUB_TOKEN"
|
||||||
|
|
||||||
# Create release
|
# Create release
|
||||||
gh release create "$TAG" \
|
RESPONSE=$(curl -s -X POST "$API/releases" \
|
||||||
--repo "${{ github.repository }}" \
|
-H "$AUTH" \
|
||||||
--title "$TAG" \
|
-H "Content-Type: application/json" \
|
||||||
--notes "Automated build for $TAG" \
|
-d "{
|
||||||
--latest
|
\"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
|
# Upload all built artifacts
|
||||||
for file in out/*.exe out/*.AppImage out/*.deb; do
|
for file in out/*.exe out/*.AppImage out/*.deb; do
|
||||||
[ -f "$file" ] || continue
|
[ -f "$file" ] || continue
|
||||||
FILENAME=$(basename "$file")
|
FILENAME=$(basename "$file")
|
||||||
|
MIME="application/octet-stream"
|
||||||
echo "Uploading: $FILENAME ($(du -h "$file" | cut -f1))"
|
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
|
done
|
||||||
|
|
||||||
echo "All assets uploaded"
|
echo "All assets uploaded"
|
||||||
|
|||||||
Reference in New Issue
Block a user