From 86149ace111763832b97d094d6099d3525de6f5f Mon Sep 17 00:00:00 2001 From: hypherionmc Date: Tue, 22 Oct 2024 19:17:45 +0200 Subject: [PATCH] [DEV] Fix Jenkins Scripts --- 1.21.2/.jenkins/Jenkinsfile.deploy | 20 ++++-- 1.21.2/.jenkins/Jenkinsfile.snapshot | 42 +++++++------ 1.21.2/NeoForge/build.gradle | 2 +- 1.21.2/build.gradle | 2 +- .../1.21.2/.jenkins/Jenkinsfile.deploy.patch | 42 +++++++++++++ .../.jenkins/Jenkinsfile.snapshot.patch | 63 +++++++++++++++++++ 6 files changed, 145 insertions(+), 26 deletions(-) create mode 100644 patches/1.21.2/.jenkins/Jenkinsfile.deploy.patch diff --git a/1.21.2/.jenkins/Jenkinsfile.deploy b/1.21.2/.jenkins/Jenkinsfile.deploy index 56e71cc..c6fa1a9 100644 --- a/1.21.2/.jenkins/Jenkinsfile.deploy +++ b/1.21.2/.jenkins/Jenkinsfile.deploy @@ -26,25 +26,33 @@ pipeline { } stage("Prepare") { steps { - sh "chmod +x ./gradlew" - sh "./gradlew clean" + dir("${WORKSPACE}/${majorMc}") { + sh "chmod +x ./gradlew" + sh "./gradlew clean" + } } } stage("Publish to Modrinth/Curseforge") { steps { - sh "./gradlew publishMod -Prelease=true" + dir("${WORKSPACE}/${majorMc}") { + sh "./gradlew publishMod -Prelease=true" + } } } stage("Publish to Maven") { steps { - sh "./gradlew publish -Prelease=true" + dir("${WORKSPACE}/${majorMc}") { + sh "./gradlew publish -Prelease=true" + } } } } post { always { - sh "./gradlew --stop" - deleteDir() + dir("${WORKSPACE}/${majorMc}") { + sh "./gradlew --stop" + deleteDir() + } discordSend webhookURL: env.FDD_WH_ADMIN, title: "CraterLib Port Deploy #${BUILD_NUMBER}", diff --git a/1.21.2/.jenkins/Jenkinsfile.snapshot b/1.21.2/.jenkins/Jenkinsfile.snapshot index 302e42f..bfc1247 100644 --- a/1.21.2/.jenkins/Jenkinsfile.snapshot +++ b/1.21.2/.jenkins/Jenkinsfile.snapshot @@ -32,15 +32,19 @@ pipeline { stage("Prepare") { steps { - sh "chmod +x ./gradlew" - sh "./gradlew build -PreleaseType=${reltype}" + dir("${WORKSPACE}/${majorMc}") { + sh "chmod +x ./gradlew" + sh "./gradlew build -PreleaseType=${reltype}" + } } } stage("Publish to Maven") { steps { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - sh "./gradlew publish -PreleaseType=${reltype}" + dir ("${WORKSPACE}/${majorMc}") { + catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { + sh "./gradlew publish -PreleaseType=${reltype}" + } } } } @@ -48,21 +52,23 @@ pipeline { post { always { - sh "./gradlew --stop" - archiveArtifacts artifacts: 'artifacts/*.jar' + dir("${WORKSPACE}/${majorMc}") { + sh "./gradlew --stop" + archiveArtifacts artifacts: 'artifacts/*.jar' - fddsnapshotter apiKey: env.PLATFORM_KEY, - projectSlug: "craterlib", - projectName: "${projectName}", - projectIcon: "${projectIcon}", - modLoaders: "${modLoaders}", - minecraftVersions: "${supportedMc}", - type: "snapshot", - dependsOn: "", - failWebhook: env.SSS_WEBHOOK, - publishWebhooks: "${env.SSS_WEBHOOK}|${env.FDD_WH}" + fddsnapshotter apiKey: env.PLATFORM_KEY, + projectSlug: "craterlib", + projectName: "${projectName}", + projectIcon: "${projectIcon}", + modLoaders: "${modLoaders}", + minecraftVersions: "${supportedMc}", + type: "snapshot", + dependsOn: "", + failWebhook: env.SSS_WEBHOOK, + publishWebhooks: "${env.SSS_WEBHOOK}|${env.FDD_WH}" - deleteDir() + deleteDir() + } } } -} \ No newline at end of file +} diff --git a/1.21.2/NeoForge/build.gradle b/1.21.2/NeoForge/build.gradle index 9dfa4ab..298607e 100644 --- a/1.21.2/NeoForge/build.gradle +++ b/1.21.2/NeoForge/build.gradle @@ -114,4 +114,4 @@ publisher { setArtifact(remapJar) setCurseEnvironment("both") setIsManualRelease(true) -} \ No newline at end of file +} diff --git a/1.21.2/build.gradle b/1.21.2/build.gradle index 04e0bbb..ad6e0f3 100644 --- a/1.21.2/build.gradle +++ b/1.21.2/build.gradle @@ -120,4 +120,4 @@ subprojects { } } -// TODO MODULE JARS \ No newline at end of file +// TODO MODULE JARS diff --git a/patches/1.21.2/.jenkins/Jenkinsfile.deploy.patch b/patches/1.21.2/.jenkins/Jenkinsfile.deploy.patch new file mode 100644 index 0000000..1857ad5 --- /dev/null +++ b/patches/1.21.2/.jenkins/Jenkinsfile.deploy.patch @@ -0,0 +1,42 @@ +--- a/.jenkins/Jenkinsfile.deploy ++++ b/.jenkins/Jenkinsfile.deploy +@@ -26,25 +26,33 @@ + } + stage("Prepare") { + steps { +- sh "chmod +x ./gradlew" +- sh "./gradlew clean" ++ dir("${WORKSPACE}/${majorMc}") { ++ sh "chmod +x ./gradlew" ++ sh "./gradlew clean" ++ } + } + } + stage("Publish to Modrinth/Curseforge") { + steps { +- sh "./gradlew publishMod -Prelease=true" ++ dir("${WORKSPACE}/${majorMc}") { ++ sh "./gradlew publishMod -Prelease=true" ++ } + } + } + stage("Publish to Maven") { + steps { +- sh "./gradlew publish -Prelease=true" ++ dir("${WORKSPACE}/${majorMc}") { ++ sh "./gradlew publish -Prelease=true" ++ } + } + } + } + post { + always { +- sh "./gradlew --stop" +- deleteDir() ++ dir("${WORKSPACE}/${majorMc}") { ++ sh "./gradlew --stop" ++ deleteDir() ++ } + + discordSend webhookURL: env.FDD_WH_ADMIN, + title: "CraterLib Port Deploy #${BUILD_NUMBER}", diff --git a/patches/1.21.2/.jenkins/Jenkinsfile.snapshot.patch b/patches/1.21.2/.jenkins/Jenkinsfile.snapshot.patch index fcb5831..15cedd7 100644 --- a/patches/1.21.2/.jenkins/Jenkinsfile.snapshot.patch +++ b/patches/1.21.2/.jenkins/Jenkinsfile.snapshot.patch @@ -9,3 +9,66 @@ pipeline { agent { +@@ -32,15 +32,19 @@ + + stage("Prepare") { + steps { +- sh "chmod +x ./gradlew" +- sh "./gradlew build -PreleaseType=${reltype}" ++ dir("${WORKSPACE}/${majorMc}") { ++ sh "chmod +x ./gradlew" ++ sh "./gradlew build -PreleaseType=${reltype}" ++ } + } + } + + stage("Publish to Maven") { + steps { +- catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { +- sh "./gradlew publish -PreleaseType=${reltype}" ++ dir ("${WORKSPACE}/${majorMc}") { ++ catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { ++ sh "./gradlew publish -PreleaseType=${reltype}" ++ } + } + } + } +@@ -48,21 +52,23 @@ + + post { + always { +- sh "./gradlew --stop" +- archiveArtifacts artifacts: 'artifacts/*.jar' +- +- fddsnapshotter apiKey: env.PLATFORM_KEY, +- projectSlug: "craterlib", +- projectName: "${projectName}", +- projectIcon: "${projectIcon}", +- modLoaders: "${modLoaders}", +- minecraftVersions: "${supportedMc}", +- type: "snapshot", +- dependsOn: "", +- failWebhook: env.SSS_WEBHOOK, +- publishWebhooks: "${env.SSS_WEBHOOK}|${env.FDD_WH}" +- +- deleteDir() ++ dir("${WORKSPACE}/${majorMc}") { ++ sh "./gradlew --stop" ++ archiveArtifacts artifacts: 'artifacts/*.jar' ++ ++ fddsnapshotter apiKey: env.PLATFORM_KEY, ++ projectSlug: "craterlib", ++ projectName: "${projectName}", ++ projectIcon: "${projectIcon}", ++ modLoaders: "${modLoaders}", ++ minecraftVersions: "${supportedMc}", ++ type: "snapshot", ++ dependsOn: "", ++ failWebhook: env.SSS_WEBHOOK, ++ publishWebhooks: "${env.SSS_WEBHOOK}|${env.FDD_WH}" ++ ++ deleteDir() ++ } + } + } + }