Merge remote-tracking branch 'origin/master'

This commit is contained in:
Taah 2022-04-07 00:37:46 -07:00
commit fa75ea945d
2 changed files with 16 additions and 8 deletions

18
Jenkinsfile vendored
View File

@ -4,7 +4,17 @@ pipeline {
stage("build") { stage("build") {
steps { steps {
withGradle { withGradle {
sh "./gradlew build javadoc publish --no-daemon" sh "./gradlew build javadoc --no-daemon"
}
}
}
stage("publish") {
when {
branch "master"
}
steps {
withGradle {
sh "./gradlew publish --no-daemon"
} }
} }
} }
@ -12,11 +22,9 @@ pipeline {
post { post {
always { always {
archiveArtifacts artifacts: "build/libs/*.jar", fingerprint: true archiveArtifacts artifacts: "build/libs/*.jar", fingerprint: true
javadoc javadocDir "build/docs/javadoc" { javadoc javadocDir: 'build/docs/javadoc', keepAll: false
javadoc keepAll false
}
discordSend description: "Jenkins", link: env.BUILD_URL, result: currentBuild.currentResult, title: JOB_NAME, webhookURL: env.PLEX_WEBHOOK_URL discordSend description: "Jenkins", link: env.BUILD_URL, result: currentBuild.currentResult, title: JOB_NAME, webhookURL: env.PLEX_WEBHOOK_URL
deleteWs() cleanWs()
} }
} }
} }

View File

@ -137,20 +137,20 @@ public class UpdateChecker extends PlexBase
public void updateJar() public void updateJar()
{ {
CloseableHttpClient client = HttpClients.createDefault(); CloseableHttpClient client = HttpClients.createDefault();
HttpGet get = new HttpGet(DOWNLOAD_PAGE + "lastSuccessfulBuild/api/json"); HttpGet get = new HttpGet(DOWNLOAD_PAGE + "job/master/lastSuccessfulBuild/api/json");
try try
{ {
HttpResponse response = client.execute(get); HttpResponse response = client.execute(get);
JSONObject object = new JSONObject(EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8)); JSONObject object = new JSONObject(EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8));
JSONObject artifact = object.getJSONArray("artifacts").getJSONObject(0); JSONObject artifact = object.getJSONArray("artifacts").getJSONObject(0);
String name = artifact.getString("displayPath"); String name = artifact.getString("fileName");
PlexLog.log("Downloading latest Plex jar file: " + name); PlexLog.log("Downloading latest Plex jar file: " + name);
CompletableFuture.runAsync(() -> CompletableFuture.runAsync(() ->
{ {
try try
{ {
FileUtils.copyURLToFile( FileUtils.copyURLToFile(
new URL(DOWNLOAD_PAGE + "lastSuccessfulBuild/artifact/build/libs/" + name), new URL(DOWNLOAD_PAGE + "job/master/lastSuccessfulBuild/artifact/build/libs/" + name),
new File(Bukkit.getUpdateFolderFile(), name) new File(Bukkit.getUpdateFolderFile(), name)
); );
PlexLog.log("Saved new jar. Please restart your server."); PlexLog.log("Saved new jar. Please restart your server.");