@@ -6,7 +6,7 @@ buildscript {
66
77plugins {
88 id " fabric-loom" version " ${ loom_version} "
9- id " com.diffplug.spotless" version " 8.0 .0"
9+ id " com.diffplug.spotless" version " 8.1 .0"
1010}
1111
1212def ENV = System . getenv()
@@ -319,60 +319,3 @@ task closeMilestone {
319319 }
320320 }
321321}
322-
323- task uploadBackups {
324- dependsOn build
325-
326- onlyIf {
327- ENV . WI_BACKUPS_API_KEY
328- }
329-
330- doLast {
331- def shortVersion = getGhVersion(). substring(1 )
332- def backupUrl = " https://api.wurstclient.net/artifact-backups/Wurst/${ shortVersion} "
333-
334- def maxRetries = 3
335- def retryCount = 0
336- def success = false
337-
338- while (! success && retryCount < maxRetries) {
339- try {
340- def connection = new URL (backupUrl). openConnection() as HttpURLConnection
341- def boundary = UUID . randomUUID(). toString()
342- connection. setRequestMethod(" POST" )
343- connection. setRequestProperty(" X-API-Key" , ENV . WI_BACKUPS_API_KEY )
344- connection. setRequestProperty(" Accept" , " application/json" )
345- connection. setRequestProperty(" Content-Type" , " multipart/form-data; boundary=$boundary " )
346- connection. doOutput = true
347-
348- def output = connection. outputStream
349- [remapJar, remapSourcesJar]. each { jarTask ->
350- def file = jarTask. archiveFile. get(). asFile
351- output << " --${ boundary} \r\n "
352- output << " Content-Disposition: form-data; name=\" files\" ; filename=\" ${ file.name} \"\r\n "
353- output << " Content-Type: application/java-archive\r\n\r\n "
354- file. withInputStream { input ->
355- output << input
356- }
357- output << " \r\n "
358- }
359- output << " --${ boundary} --\r\n "
360- output. flush()
361-
362- if (connection. responseCode != 200 ) {
363- throw new IOException (" HTTP ${ connection.responseCode} : ${ connection.responseMessage} " )
364- }
365-
366- success = true
367-
368- } catch (Exception e) {
369- retryCount++
370- if (retryCount >= maxRetries) {
371- throw new GradleException (" Failed to upload backups after ${ maxRetries} attempts: ${ e.message} " )
372- }
373- println " Upload attempt ${ retryCount} failed: ${ e.message} . Retrying in 5 seconds..."
374- Thread . sleep(5000 )
375- }
376- }
377- }
378- }
0 commit comments