@@ -539,44 +539,6 @@ jobs:
539539 if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
540540 LATEST_RELEASE=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/latest)
541541 LATEST=$(echo "$LATEST_RELEASE" | jq -r '.name')
542- # Check artifact sizes against previous release
543- if [ -n "$LATEST" ] && [ "$LATEST" != "null" ]; then
544- echo "Checking artifact sizes against previous release: $LATEST"
545- FAILED=0
546- for artifact in ai-*-${VERSION}.*; do
547- if [ ! -f "$artifact" ]; then
548- continue
549- fi
550- # Get current artifact size
551- NEW_SIZE=$(stat -c%s "$artifact" 2>/dev/null || stat -f%z "$artifact")
552- # Get artifact name for previous release
553- ARTIFACT_NAME=$(echo "$artifact" | sed "s/${VERSION}/${LATEST}/")
554- # Get previous artifact size from GitHub API
555- OLD_SIZE=$(echo "$LATEST_RELEASE" | jq -r ".assets[] | select(.name == \"$(basename "$ARTIFACT_NAME")\") | .size")
556- if [ -z "$OLD_SIZE" ] || [ "$OLD_SIZE" = "null" ]; then
557- echo "⚠️ Previous artifact not found: $(basename "$ARTIFACT_NAME"), skipping comparison"
558- continue
559- fi
560- # Calculate percentage increase
561- INCREASE=$(awk "BEGIN {printf \"%.2f\", (($NEW_SIZE - $OLD_SIZE) / $OLD_SIZE) * 100}")
562- echo "📦 $artifact: $OLD_SIZE → $NEW_SIZE bytes (${INCREASE}% change)"
563- # Check if increase is more than 5%
564- if (( $(echo "$INCREASE > 5" | bc -l) )); then
565- if [ "$GITHUB_EVENT_NAME" = "workflow_dispatch" ]; then
566- echo "⚠️ WARNING: $artifact size increased by ${INCREASE}% (limit: 5%)"
567- else
568- echo "❌ ERROR: $artifact size increased by ${INCREASE}% (limit: 5%)"
569- FAILED=1
570- fi
571- fi
572- done
573- if [ $FAILED -eq 1 ]; then
574- echo ""
575- echo "❌ One or more artifacts exceeded the 5% size increase limit"
576- exit 1
577- fi
578- echo "✅ All artifacts within 5% size increase limit"
579- fi
580542 if [[ "$VERSION" != "$LATEST" || "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then
581543 echo "version=$VERSION" >> $GITHUB_OUTPUT
582544 else
0 commit comments