3030
3131jobs :
3232 build-and-publish :
33- runs-on : blacksmith-4vcpu- ubuntu-2404
33+ runs-on : ubuntu-latest
3434 outputs :
3535 gradle_version : ${{ steps.versions.outputs.gradle_version }}
3636 commit_hash : ${{ steps.versions.outputs.commit_hash }}
@@ -61,25 +61,57 @@ jobs:
6161 echo "gradle_version=$(./gradlew properties -q | grep "version:" | awk '{print $2}')" >> $GITHUB_OUTPUT
6262 echo "commit_hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
6363
64- - name : Build and Publish All
64+ - name : Build Artifacts
6565 run : |
66- # Build everything once
6766 ./gradlew clean build shadowJar \
68- publishMavenJavaPublicationToSimplecloudRepository \
69- modrinth modrinthSyncBody \
7067 --parallel \
7168 --build-cache \
72- --configuration-cache
69+ --no- configuration-cache
7370
74- # Copy artifacts
7571 mkdir -p artifacts
7672 cp platform/spigot/build/libs/spigot.jar artifacts/
7773 cp platform/bungeecord/build/libs/bungeecord.jar artifacts/
7874 cp platform/velocity/build/libs/velocity.jar artifacts/
75+ # Add spigot-legacy if it exists
76+ if [ -f platform/spigot-legacy/build/libs/spigot-legacy.jar ]; then
77+ cp platform/spigot-legacy/build/libs/spigot-legacy.jar artifacts/
78+ fi
79+ env :
80+ COMMIT_HASH : ${{ steps.versions.outputs.commit_hash }}
81+
82+ - name : Publish to Maven
83+ run : |
84+ ./gradlew publishMavenJavaPublicationToSimplecloudRepository \
85+ --parallel \
86+ --build-cache \
87+ --no-configuration-cache
7988 env :
8089 COMMIT_HASH : ${{ steps.versions.outputs.commit_hash }}
8190 SIMPLECLOUD_USERNAME : ${{ secrets.SIMPLECLOUD_USERNAME }}
8291 SIMPLECLOUD_PASSWORD : ${{ secrets.SIMPLECLOUD_PASSWORD }}
92+
93+ - name : Publish to Modrinth (with retries)
94+ uses : nick-fields/retry-action@v3
95+ with :
96+ timeout_minutes : 10
97+ max_attempts : 3
98+ retry_wait_seconds : 30
99+ command : |
100+ ./gradlew modrinth \
101+ --parallel \
102+ --build-cache \
103+ --no-configuration-cache \
104+ -Dorg.gradle.internal.http.socketTimeout=180000 \
105+ -Dorg.gradle.internal.http.connectionTimeout=180000
106+ env :
107+ COMMIT_HASH : ${{ steps.versions.outputs.commit_hash }}
108+ MODRINTH_TOKEN : ${{ secrets.MODRINTH_TOKEN }}
109+
110+ - name : Sync Modrinth Body
111+ run : |
112+ ./gradlew modrinthSyncBody \
113+ --no-configuration-cache
114+ env :
83115 MODRINTH_TOKEN : ${{ secrets.MODRINTH_TOKEN }}
84116
85117 - name : Upload artifacts
@@ -103,16 +135,26 @@ jobs:
103135 id : create_registry_release
104136 run : |
105137 RELEASE_URL="${REGISTRY_URL}/v1/applications/${APP_SLUG}/releases"
106- response=$(curl -s -X POST \
138+ response=$(curl -s -w "\n%{http_code}" - X POST \
107139 -H "Authorization: Bearer ${{ secrets.REGISTRY_TOKEN }}" \
108140 -H "Content-Type: application/json" \
109141 "$RELEASE_URL" \
110142 -d '{
111143 "version": "'"${{ needs.build-and-publish.outputs.gradle_version }}"'",
112144 "manual_update": false
113145 }')
114- echo "Response: $response"
115- APP_ID=$(echo $response | jq -r '.release.application_id')
146+
147+ http_code=$(echo "$response" | tail -n1)
148+ body=$(echo "$response" | sed '$d')
149+
150+ if [ "$http_code" -ge 400 ]; then
151+ echo "Error: HTTP $http_code"
152+ echo "$body"
153+ exit 1
154+ fi
155+
156+ echo "Response: $body"
157+ APP_ID=$(echo "$body" | jq -r '.release.application_id')
116158 echo "APP_ID=$APP_ID" >> $GITHUB_ENV
117159 echo "Release created with APP_ID: $APP_ID"
118160
@@ -125,24 +167,58 @@ jobs:
125167 local ARCH=$2
126168 local URL="${REGISTRY_URL}/v1/applications/${APP_ID}/releases/${{ needs.build-and-publish.outputs.gradle_version }}/files"
127169
128- curl -s -X POST \
170+ echo "Uploading $ARCH..."
171+ response=$(curl -s -w "\n%{http_code}" -X POST \
172+ --max-time 300 \
173+ --retry 3 \
174+ --retry-delay 5 \
129175 -H "Authorization: Bearer ${{ secrets.REGISTRY_TOKEN }}" \
130176 -H "Content-Type: multipart/form-data" \
131177 -F "file=@$FILE" \
132178 -F "platform=minecraft_plugin" \
133179 -F "arch=$ARCH" \
134180 -F "platform_versions=$PLATFORM_VERSIONS" \
135- "$URL"
181+ "$URL")
182+
183+ http_code=$(echo "$response" | tail -n1)
184+ body=$(echo "$response" | sed '$d')
185+
186+ if [ "$http_code" -ge 400 ]; then
187+ echo "Error uploading $ARCH: HTTP $http_code"
188+ echo "$body"
189+ return 1
190+ fi
191+
192+ echo "✓ $ARCH uploaded successfully"
193+ return 0
136194 }
137195
138196 # Upload all platforms in parallel
139197 upload_file "artifacts/spigot.jar" "spigot" &
198+ PID_SPIGOT=$!
199+
140200 upload_file "artifacts/spigot.jar" "paper" &
201+ PID_PAPER=$!
202+
141203 upload_file "artifacts/bungeecord.jar" "bungeecord" &
204+ PID_BUNGEE=$!
205+
142206 upload_file "artifacts/velocity.jar" "velocity" &
207+ PID_VELOCITY=$!
208+
209+ # Wait for all uploads and check exit codes
210+ FAILED=0
211+ wait $PID_SPIGOT || FAILED=1
212+ wait $PID_PAPER || FAILED=1
213+ wait $PID_BUNGEE || FAILED=1
214+ wait $PID_VELOCITY || FAILED=1
215+
216+ if [ $FAILED -eq 1 ]; then
217+ echo "One or more uploads failed"
218+ exit 1
219+ fi
143220
144- wait
145- echo "All uploads completed"
221+ echo "All uploads completed successfully"
146222
147223 create-github-release :
148224 needs : [ build-and-publish, publish-registry ]
@@ -185,7 +261,7 @@ jobs:
185261 echo "Skipping $jar due to version number"
186262 else
187263 echo "Uploading $jar"
188- gh release upload "$RELEASE_TAG" "$jar"
264+ gh release upload "$RELEASE_TAG" "$jar" --clobber
189265 fi
190266 done
191267 env :
0 commit comments