2323 1.21.3
2424 1.21.4
2525 1.21.5
26+ 1.21.6
27+ 1.21.7
28+ 1.21.8
29+ 1.21.9
2630
2731jobs :
28- build :
29- runs-on : ubuntu-latest
32+ build-and-publish :
33+ runs-on : blacksmith-4vcpu- ubuntu-2404
3034 outputs :
3135 gradle_version : ${{ steps.versions.outputs.gradle_version }}
3236 commit_hash : ${{ steps.versions.outputs.commit_hash }}
3337 steps :
3438 - name : Checkout repository
35- uses : actions/checkout@v3
39+ uses : actions/checkout@v4
3640 with :
3741 ref : main
3842
3943 - name : Set up JDK 21
40- uses : actions/setup-java@v3
44+ uses : actions/setup-java@v4
4145 with :
42- distribution : ' adopt '
46+ distribution : ' temurin '
4347 java-version : ' 21'
48+ cache : ' gradle'
4449
45- - name : Cache Gradle packages
46- uses : actions/cache @v3
50+ - name : Setup Gradle
51+ uses : gradle/ actions/setup-gradle @v3
4752 with :
48- path : |
49- ~/.gradle/caches
50- ~/.gradle/wrapper
51- key : gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
52- restore-keys : |
53- gradle-${{ runner.os }}
53+ cache-read-only : false
5454
5555 - name : Make gradlew executable
5656 run : chmod +x ./gradlew
@@ -61,13 +61,26 @@ 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 ShadowJars
64+ - name : Build and Publish All
6565 run : |
66- ./gradlew clean build shadowJar
66+ # Build everything once
67+ ./gradlew clean build shadowJar \
68+ publishMavenJavaPublicationToSimplecloudRepository \
69+ modrinth modrinthSyncBody \
70+ --parallel \
71+ --build-cache \
72+ --configuration-cache
73+
74+ # Copy artifacts
6775 mkdir -p artifacts
6876 cp platform/spigot/build/libs/spigot.jar artifacts/
6977 cp platform/bungeecord/build/libs/bungeecord.jar artifacts/
7078 cp platform/velocity/build/libs/velocity.jar artifacts/
79+ env :
80+ COMMIT_HASH : ${{ steps.versions.outputs.commit_hash }}
81+ SIMPLECLOUD_USERNAME : ${{ secrets.SIMPLECLOUD_USERNAME }}
82+ SIMPLECLOUD_PASSWORD : ${{ secrets.SIMPLECLOUD_PASSWORD }}
83+ MODRINTH_TOKEN : ${{ secrets.MODRINTH_TOKEN }}
7184
7285 - name : Upload artifacts
7386 uses : actions/upload-artifact@v4
7790 compression-level : 0
7891
7992 publish-registry :
80- needs : build
93+ needs : build-and-publish
8194 runs-on : ubuntu-latest
8295 steps :
8396 - name : Download artifacts
@@ -90,170 +103,57 @@ jobs:
90103 id : create_registry_release
91104 run : |
92105 RELEASE_URL="${REGISTRY_URL}/v1/applications/${APP_SLUG}/releases"
93- echo "Creating release at: $RELEASE_URL"
94- echo "Headers:"
95- echo " Content-Type: application/json"
96- echo "Body:"
97- echo '{
98- "version": "'"${{ needs.build.outputs.gradle_version }}"'",
99- "manual_update": false
100- }'
101- response=$(curl -X POST \
106+ response=$(curl -s -X POST \
102107 -H "Authorization: Bearer ${{ secrets.REGISTRY_TOKEN }}" \
103108 -H "Content-Type: application/json" \
104109 "$RELEASE_URL" \
105110 -d '{
106- "version": "'"${{ needs.build.outputs.gradle_version }}"'",
111+ "version": "'"${{ needs.build-and-publish .outputs.gradle_version }}"'",
107112 "manual_update": false
108113 }')
109114 echo "Response: $response"
110115 APP_ID=$(echo $response | jq -r '.release.application_id')
111116 echo "APP_ID=$APP_ID" >> $GITHUB_ENV
112117 echo "Release created with APP_ID: $APP_ID"
113118
114- - name : Upload to Registry
119+ - name : Upload to Registry (Parallel)
115120 run : |
116- # Convert newline-separated versions into simple JSON array
117121 PLATFORM_VERSIONS=$(echo "$MINECRAFT_VERSIONS" | jq -R -s 'split("\n") | map(select(length > 0))')
118- echo "Using platform versions: $PLATFORM_VERSIONS"
119-
120- # Upload Spigot Platform
121- SPIGOT_URL="${REGISTRY_URL}/v1/applications/${APP_ID}/releases/${{ needs.build.outputs.gradle_version }}/files"
122- echo "Uploading Spigot to: $SPIGOT_URL"
123- echo "Headers:"
124- echo " Content-Type: multipart/form-data"
125- echo "Form data:"
126- echo " platform: minecraft_plugin"
127- echo " arch: spigot"
128- echo " platform_versions: $PLATFORM_VERSIONS"
129- curl -X POST \
130- -H "Authorization: Bearer ${{ secrets.REGISTRY_TOKEN }}" \
131- -H "Content-Type: multipart/form-data" \
132- -F "file=@artifacts/spigot.jar" \
133- -F "platform=minecraft_plugin" \
134- -F "arch=spigot" \
135- -F "platform_versions=$PLATFORM_VERSIONS" \
136- "$SPIGOT_URL"
137-
138- # Upload Paper Platform (same jar as Spigot)
139- PAPER_URL="${REGISTRY_URL}/v1/applications/${APP_ID}/releases/${{ needs.build.outputs.gradle_version }}/files"
140- echo "Uploading Paper to: $PAPER_URL"
141- echo "Headers:"
142- echo " Content-Type: multipart/form-data"
143- echo "Form data:"
144- echo " platform: minecraft_plugin"
145- echo " arch: paper"
146- echo " platform_versions: $PLATFORM_VERSIONS"
147- curl -X POST \
148- -H "Authorization: Bearer ${{ secrets.REGISTRY_TOKEN }}" \
149- -H "Content-Type: multipart/form-data" \
150- -F "file=@artifacts/spigot.jar" \
151- -F "platform=minecraft_plugin" \
152- -F "arch=paper" \
153- -F "platform_versions=$PLATFORM_VERSIONS" \
154- "$PAPER_URL"
155-
156- # Upload BungeeCord Platform
157- BUNGEE_URL="${REGISTRY_URL}/v1/applications/${APP_ID}/releases/${{ needs.build.outputs.gradle_version }}/files"
158- echo "Uploading BungeeCord to: $BUNGEE_URL"
159- echo "Headers:"
160- echo " Content-Type: multipart/form-data"
161- echo "Form data:"
162- echo " platform: minecraft_plugin"
163- echo " arch: bungeecord"
164- echo " platform_versions: $PLATFORM_VERSIONS"
165- curl -X POST \
166- -H "Authorization: Bearer ${{ secrets.REGISTRY_TOKEN }}" \
167- -H "Content-Type: multipart/form-data" \
168- -F "file=@artifacts/bungeecord.jar" \
169- -F "platform=minecraft_plugin" \
170- -F "arch=bungeecord" \
171- -F "platform_versions=$PLATFORM_VERSIONS" \
172- "$BUNGEE_URL"
173-
174- # Upload Velocity Platform
175- VELOCITY_URL="${REGISTRY_URL}/v1/applications/${APP_ID}/releases/${{ needs.build.outputs.gradle_version }}/files"
176- echo "Uploading Velocity to: $VELOCITY_URL"
177- echo "Headers:"
178- echo " Content-Type: multipart/form-data"
179- echo "Form data:"
180- echo " platform: minecraft_plugin"
181- echo " arch: velocity"
182- echo " platform_versions: $PLATFORM_VERSIONS"
183- curl -X POST \
184- -H "Authorization: Bearer ${{ secrets.REGISTRY_TOKEN }}" \
185- -H "Content-Type: multipart/form-data" \
186- -F "file=@artifacts/velocity.jar" \
187- -F "platform=minecraft_plugin" \
188- -F "arch=velocity" \
189- -F "platform_versions=$PLATFORM_VERSIONS" \
190- "$VELOCITY_URL"
191-
122+
123+ upload_file() {
124+ local FILE=$1
125+ local ARCH=$2
126+ local URL="${REGISTRY_URL}/v1/applications/${APP_ID}/releases/${{ needs.build-and-publish.outputs.gradle_version }}/files"
127+
128+ curl -s -X POST \
129+ -H "Authorization: Bearer ${{ secrets.REGISTRY_TOKEN }}" \
130+ -H "Content-Type: multipart/form-data" \
131+ -F "file=@$FILE" \
132+ -F "platform=minecraft_plugin" \
133+ -F "arch=$ARCH" \
134+ -F "platform_versions=$PLATFORM_VERSIONS" \
135+ "$URL"
136+ }
137+
138+ # Upload all platforms in parallel
139+ upload_file "artifacts/spigot.jar" "spigot" &
140+ upload_file "artifacts/spigot.jar" "paper" &
141+ upload_file "artifacts/bungeecord.jar" "bungeecord" &
142+ upload_file "artifacts/velocity.jar" "velocity" &
143+
144+ wait
192145 echo "All uploads completed"
193146
194- publish-maven :
195- needs : build
196- runs-on : ubuntu-latest
197- steps :
198- - name : Checkout repository
199- uses : actions/checkout@v3
200- with :
201- ref : main
202-
203- - name : Set up JDK 21
204- uses : actions/setup-java@v3
205- with :
206- distribution : ' adopt'
207- java-version : ' 21'
208-
209- - name : Make gradlew executable
210- run : chmod +x ./gradlew
211-
212- - name : Publish to SimpleCloud Repository
213- run : ./gradlew publishMavenJavaPublicationToSimplecloudRepository
214- env :
215- COMMIT_HASH : ${{ needs.build.outputs.commit_hash }}
216- SIMPLECLOUD_USERNAME : ${{ secrets.SIMPLECLOUD_USERNAME }}
217- SIMPLECLOUD_PASSWORD : ${{ secrets.SIMPLECLOUD_PASSWORD }}
218-
219- publish-modrinth :
220- needs : build
221- runs-on : ubuntu-latest
222- steps :
223- - name : Checkout repository
224- uses : actions/checkout@v3
225- with :
226- ref : main
227-
228- - name : Set up JDK 21
229- uses : actions/setup-java@v3
230- with :
231- distribution : ' adopt'
232- java-version : ' 21'
233-
234- - name : Download artifacts
235- uses : actions/download-artifact@v4
236- with :
237- name : build-artifacts
238- path : platform
239-
240- - name : Make gradlew executable
241- run : chmod +x ./gradlew
242-
243- - name : Publish to Modrinth
244- run : ./gradlew modrinth && ./gradlew modrinthSyncBody
245- env :
246- COMMIT_HASH : ${{ needs.build.outputs.commit_hash }}
247- MODRINTH_TOKEN : ${{ secrets.MODRINTH_TOKEN }}
248-
249147 create-github-release :
250- needs : [ build, publish-registry, publish-maven , publish-modrinth ]
148+ needs : [ build-and-publish , publish-registry ]
251149 runs-on : ubuntu-latest
252150 steps :
253151 - name : Checkout repository
254- uses : actions/checkout@v3
152+ uses : actions/checkout@v4
255153 with :
256154 ref : main
155+ sparse-checkout : |
156+ .github
257157
258158 - name : Download artifacts
259159 uses : actions/download-artifact@v4
@@ -264,8 +164,8 @@ jobs:
264164 - name : Create GitHub Release
265165 id : create_release
266166 run : |
267- RELEASE_TAG="v${{ needs.build.outputs.gradle_version }}-dev.${{ needs.build.outputs.commit_hash }}"
268- RELEASE_NAME="v${{ needs.build.outputs.gradle_version }}-dev.${{ needs.build.outputs.commit_hash }}"
167+ RELEASE_TAG="v${{ needs.build-and-publish .outputs.gradle_version }}-dev.${{ needs.build-and-publish .outputs.commit_hash }}"
168+ RELEASE_NAME="v${{ needs.build-and-publish .outputs.gradle_version }}-dev.${{ needs.build-and-publish .outputs.commit_hash }}"
269169 RELEASE_BODY="This release contains dev builds for all platform modules."
270170
271171 gh release create "$RELEASE_TAG" \
@@ -274,7 +174,6 @@ jobs:
274174 --target main \
275175 --prerelease
276176
277- # Export the release tag for use in the next step
278177 echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
279178 env :
280179 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments