@@ -9,39 +9,46 @@ isDebugging && set -x
9
9
resolveVersion
10
10
: " ${MOHIST_BUILD:= lastSuccessfulBuild} "
11
11
12
- mohistBaseUrl=https://ci.codemc.io/job/MohistMC/
13
- mohistJobs=${mohistBaseUrl} job/
14
- mohistJob=${mohistJobs} Mohist-${VERSION} /
12
+ mohistBaseUrl=" https://mohistmc.com/api/v2/projects/mohist/"
13
+ mohistApiUrl=" ${mohistBaseUrl}${VERSION} /builds/"
15
14
16
15
function logMohistAvailableVerisons(){
17
16
logError " check ${mohistBaseUrl} for available versions"
18
17
logError " and set VERSION accordingly"
19
18
}
20
19
21
- if ! get --exists " ${mohistJob } " ; then
20
+ if ! get --exists " ${mohistApiUrl } " ; then
22
21
logError " Mohist builds do not exist for ${VERSION} "
23
22
logMohistAvailableVerisons
24
23
exit 1
25
24
fi
26
25
27
- buildRelPath=$(
28
- get --json-path ' $.artifacts[0].relativePath' " ${mohistJob}${MOHIST_BUILD} /api/json"
26
+ if [[ " ${MOHIST_BUILD} " == " lastSuccessfulBuild" ]]; then
27
+ # Get the latest build number from the API
28
+ buildNumber=$(
29
+ get --json-path ' $.builds[-1].number' " ${mohistApiUrl} "
30
+ )
31
+ MOHIST_BUILD=" ${buildNumber} "
32
+ fi
33
+
34
+ downloadUrl=$(
35
+ get --json-path " $.builds[?(@.number==${MOHIST_BUILD} )].url" " ${mohistApiUrl} "
29
36
)
30
37
31
- baseName=$( basename " ${buildRelPath} " )
32
- if [[ ${baseName} != * -server.jar* ]]; then
33
- logError " Mohist build for ${VERSION} is not a valid server jar, found ${baseName} "
38
+ if [[ -z " ${downloadUrl} " ]]; then
39
+ logError " Could not find build ${MOHIST_BUILD} for version ${VERSION} "
34
40
logMohistAvailableVerisons
35
41
exit 1
36
42
fi
37
43
38
- export SERVER=" /data/${baseName} "
44
+ SERVER=" /data/mohist- ${VERSION} - ${MOHIST_BUILD} -server.jar "
39
45
40
46
if [ ! -f " ${SERVER} " ]; then
41
- log " Downloading ${baseName }"
42
- get -o " ${SERVER} " " ${mohistJob}${MOHIST_BUILD} /artifact/ ${buildRelPath }"
47
+ log " Downloading Mohist build ${MOHIST_BUILD} for ${VERSION }"
48
+ get -o " ${SERVER} " " ${downloadUrl } "
43
49
fi
44
50
45
51
export FAMILY=HYBRID
52
+ export SERVER
46
53
47
54
exec " ${SCRIPTS:-/ } start-spiget" " $@ "
0 commit comments