File tree Expand file tree Collapse file tree 1 file changed +29
-2
lines changed Expand file tree Collapse file tree 1 file changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -293,8 +293,35 @@ jobs:
293
293
apiToken : ${{ secrets.CF_R2_API_TOKEN }}
294
294
wranglerVersion : " 4.21.1"
295
295
command : |
296
- r2 object put nginx-ui-dev-build/${{ env.DIST }}.tar.gz --file ./${{ env.DIST }}.tar.gz --remote
297
- r2 object put nginx-ui-dev-build/${{ env.DIST }}.tar.gz.digest --file ./${{ env.DIST }}.tar.gz.digest --remote
296
+ # Define retry function
297
+ retry_upload() {
298
+ local file_path="$1"
299
+ local remote_path="$2"
300
+ local max_attempts=3
301
+ local attempt=1
302
+
303
+ while [ $attempt -le $max_attempts ]; do
304
+ echo "Attempt $attempt of $max_attempts: Uploading $file_path to $remote_path"
305
+ if r2 object put "$remote_path" --file "$file_path" --remote; then
306
+ echo "Successfully uploaded $file_path on attempt $attempt"
307
+ return 0
308
+ else
309
+ echo "Failed to upload $file_path on attempt $attempt"
310
+ if [ $attempt -lt $max_attempts ]; then
311
+ echo "Waiting 5 seconds before retry..."
312
+ sleep 5
313
+ fi
314
+ attempt=$((attempt + 1))
315
+ fi
316
+ done
317
+
318
+ echo "Failed to upload $file_path after $max_attempts attempts"
319
+ return 1
320
+ }
321
+
322
+ # Upload files with retry
323
+ retry_upload ./${{ env.DIST }}.tar.gz nginx-ui-dev-build/${{ env.DIST }}.tar.gz
324
+ retry_upload ./${{ env.DIST }}.tar.gz.digest nginx-ui-dev-build/${{ env.DIST }}.tar.gz.digest
298
325
299
326
docker-build :
300
327
if : github.event_name != 'pull_request'
You can’t perform that action at this time.
0 commit comments