@@ -278,55 +278,6 @@ jobs:
278278 LATEST_RELEASE=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/latest)
279279 LATEST=$(echo "$LATEST_RELEASE" | jq -r '.name')
280280
281- # Check artifact sizes against previous release
282- if [ -n "$LATEST" ] && [ "$LATEST" != "null" ]; then
283- echo "Checking artifact sizes against previous release: $LATEST"
284- FAILED=0
285-
286- for artifact in agent-*-${VERSION}.*; do
287- if [ ! -f "$artifact" ]; then
288- continue
289- fi
290-
291- # Get current artifact size
292- NEW_SIZE=$(stat -c%s "$artifact" 2>/dev/null || stat -f%z "$artifact")
293-
294- # Get artifact name for previous release
295- ARTIFACT_NAME=$(echo "$artifact" | sed "s/${VERSION}/${LATEST}/")
296-
297- # Get previous artifact size from GitHub API
298- OLD_SIZE=$(echo "$LATEST_RELEASE" | jq -r ".assets[] | select(.name == \"$(basename "$ARTIFACT_NAME")\") | .size")
299-
300- if [ -z "$OLD_SIZE" ] || [ "$OLD_SIZE" = "null" ]; then
301- echo "⚠️ Previous artifact not found: $(basename "$ARTIFACT_NAME"), skipping comparison"
302- continue
303- fi
304-
305- # Calculate percentage increase
306- INCREASE=$(awk "BEGIN {printf \"%.2f\", (($NEW_SIZE - $OLD_SIZE) / $OLD_SIZE) * 100}")
307-
308- echo "📦 $artifact: $OLD_SIZE → $NEW_SIZE bytes (${INCREASE}% change)"
309-
310- # Check if increase is more than 5%
311- if (( $(echo "$INCREASE > 5" | bc -l) )); then
312- if [ "$GITHUB_EVENT_NAME" = "workflow_dispatch" ]; then
313- echo "⚠️ WARNING: $artifact size increased by ${INCREASE}% (limit: 5%)"
314- else
315- echo "❌ ERROR: $artifact size increased by ${INCREASE}% (limit: 5%)"
316- FAILED=1
317- fi
318- fi
319- done
320-
321- if [ $FAILED -eq 1 ]; then
322- echo ""
323- echo "❌ One or more artifacts exceeded the 5% size increase limit"
324- exit 1
325- fi
326-
327- echo "✅ All artifacts within 5% size increase limit"
328- fi
329-
330281 if [[ "$VERSION" != "$LATEST" || "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then
331282 echo "version=$VERSION" >> $GITHUB_OUTPUT
332283 else
0 commit comments