|
@@ -102,16 +102,26 @@ runs:
|
|
|
local file=$1
|
|
local file=$1
|
|
|
local tag_name=$2
|
|
local tag_name=$2
|
|
|
local max_attempts=3
|
|
local max_attempts=3
|
|
|
|
|
+ local timeout_duration="30m" # Increased timeout for large files
|
|
|
|
|
+
|
|
|
for ((i=1; i<=max_attempts; i++)); do
|
|
for ((i=1; i<=max_attempts; i++)); do
|
|
|
echo " Attempt $i for $file..."
|
|
echo " Attempt $i for $file..."
|
|
|
|
|
|
|
|
- if timeout 10m gh release upload "$tag_name" "$file" --clobber --repo "$TARGET_REPO" > /dev/null 2>&1; then
|
|
|
|
|
- echo " Successfully uploaded $file"
|
|
|
|
|
|
|
+ if timeout $timeout_duration gh release upload "$tag_name" "$file" --clobber --repo "$TARGET_REPO"; then
|
|
|
|
|
+ echo " ✅ Successfully uploaded $file"
|
|
|
return 0
|
|
return 0
|
|
|
|
|
+ else
|
|
|
|
|
+ local exit_code=$?
|
|
|
|
|
+ if [ $exit_code -eq 124 ]; then
|
|
|
|
|
+ echo " ⚠ Attempt $i timed out (timeout after $timeout_duration). Retrying..."
|
|
|
|
|
+ else
|
|
|
|
|
+ echo " ⚠ Attempt $i failed with exit code $exit_code. Retrying..."
|
|
|
|
|
+ fi
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
- echo " ⚠ Attempt $i failed or timed out. Retrying..."
|
|
|
|
|
- sleep 5
|
|
|
|
|
|
|
+ if [ $i -lt $max_attempts ]; then
|
|
|
|
|
+ sleep 5
|
|
|
|
|
+ fi
|
|
|
done
|
|
done
|
|
|
return 1
|
|
return 1
|
|
|
}
|
|
}
|
|
@@ -162,22 +172,21 @@ runs:
|
|
|
MAX_SIZE=2000000000 # ~1.86GB
|
|
MAX_SIZE=2000000000 # ~1.86GB
|
|
|
|
|
|
|
|
if [ "$FILE_SIZE" -gt "$MAX_SIZE" ]; then
|
|
if [ "$FILE_SIZE" -gt "$MAX_SIZE" ]; then
|
|
|
- echo "⚠ File > 2GB. Splitting..."
|
|
|
|
|
|
|
+ echo "⚠️ File > 2GB. Splitting into 1.5GB chunks..."
|
|
|
split -b 1500M -a 2 "$FILENAME" "${FILENAME}.part"
|
|
split -b 1500M -a 2 "$FILENAME" "${FILENAME}.part"
|
|
|
for part in "${FILENAME}".part*; do
|
|
for part in "${FILENAME}".part*; do
|
|
|
- echo "Uploading $part..."
|
|
|
|
|
|
|
+ echo " Uploading $part..."
|
|
|
if ! upload_with_retry "$part" "$TAG_NAME"; then
|
|
if ! upload_with_retry "$part" "$TAG_NAME"; then
|
|
|
- echo "::error::Failed to upload part $part after multiple attempts."
|
|
|
|
|
- exit 1
|
|
|
|
|
|
|
+ echo "::warning::Failed to upload part $part after 3 attempts. Continuing with next cache..."
|
|
|
fi
|
|
fi
|
|
|
rm -f "$part"
|
|
rm -f "$part"
|
|
|
done
|
|
done
|
|
|
rm -rf "$FILENAME"
|
|
rm -rf "$FILENAME"
|
|
|
else
|
|
else
|
|
|
- echo "Uploading $FILENAME..."
|
|
|
|
|
|
|
+ echo " File size: $((FILE_SIZE / 1024 / 1024))MB"
|
|
|
|
|
+ echo " Uploading $FILENAME..."
|
|
|
if ! upload_with_retry "$FILENAME" "$TAG_NAME"; then
|
|
if ! upload_with_retry "$FILENAME" "$TAG_NAME"; then
|
|
|
- echo "::error::Failed to upload $FILENAME after multiple attempts."
|
|
|
|
|
- exit 1
|
|
|
|
|
|
|
+ echo "::warning::Failed to upload $FILENAME after 3 attempts. The cache will not be available for next run."
|
|
|
fi
|
|
fi
|
|
|
rm -f "$FILENAME"
|
|
rm -f "$FILENAME"
|
|
|
fi
|
|
fi
|