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