@@ -314,45 +314,6 @@ jobs:
314314 if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
315315 LATEST_RELEASE=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/latest)
316316 LATEST=$(echo "$LATEST_RELEASE" | jq -r '.name')
317- # Check artifact sizes against previous release
318- if [ -n "$LATEST" ] && [ "$LATEST" != "null" ]; then
319- echo "Checking artifact sizes against previous release: $LATEST"
320- FAILED=0
321- for artifact in cloudsync-*-${VERSION}.*; do
322- if [ ! -f "$artifact" ]; then
323- continue
324- fi
325- # Get current artifact size
326- NEW_SIZE=$(stat -c%s "$artifact" 2>/dev/null || stat -f%z "$artifact")
327- # Get artifact name for previous release
328- ARTIFACT_NAME=$(echo "$artifact" | sed "s/${VERSION}/${LATEST}/")
329- # Get previous artifact size from GitHub API
330- OLD_SIZE=$(echo "$LATEST_RELEASE" | jq -r ".assets[] | select(.name == \"$(basename "$ARTIFACT_NAME")\") | .size")
331- if [ -z "$OLD_SIZE" ] || [ "$OLD_SIZE" = "null" ]; then
332- echo "⚠️ Previous artifact not found: $(basename "$ARTIFACT_NAME"), skipping comparison"
333- continue
334- fi
335- # Calculate percentage increase
336- INCREASE=$(awk "BEGIN {printf \"%.2f\", (($NEW_SIZE - $OLD_SIZE) / $OLD_SIZE) * 100}")
337- echo "📦 $artifact: $OLD_SIZE → $NEW_SIZE bytes (${INCREASE}% change)"
338- # Check if increase is more than 5%
339- if (( $(echo "$INCREASE > 5" | bc -l) )); then
340- if [ "$GITHUB_EVENT_NAME" = "workflow_dispatch" ]; then
341- echo "⚠️ WARNING: $artifact size increased by ${INCREASE}% (limit: 5%)"
342- else
343- echo "❌ ERROR: $artifact size increased by ${INCREASE}% (limit: 5%)"
344- FAILED=1
345- fi
346- fi
347- done
348- if [ $FAILED -eq 1 ]; then
349- echo ""
350- echo "❌ One or more artifacts exceeded the 5% size increase limit"
351- exit 1
352- fi
353- echo "✅ All artifacts within 5% size increase limit"
354- fi
355-
356317 if [[ "$VERSION" != "$LATEST" || "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then
357318 echo "version=$VERSION" >> $GITHUB_OUTPUT
358319 else
0 commit comments