diff options
-rw-r--r-- | Jenkinsfile | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/Jenkinsfile b/Jenkinsfile index ff1ebbf..7e93cc7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,18 +3,23 @@ pipeline { agent { docker { - image 'gradlewrapper:j10' + image 'gradle:jdk8' args '-v gradlecache:/gradlecache' } } environment { - GRADLE_ARGS = '-Dorg.gradle.daemon.idletimeout=5000 --console=plain' + GRADLE_ARGS = '-Dorg.gradle.daemon.idletimeout=5000' DISCORD_WEBHOOK = credentials('forge-discord-jenkins-webhook') DISCORD_PREFIX = "Job: Artifactural Branch: ${BRANCH_NAME} Build: #${BUILD_NUMBER}" JENKINS_HEAD = 'https://wiki.jenkins-ci.org/download/attachments/2916393/headshot.png' } stages { + stage('fetch') { + steps { + checkout scm + } + } stage('notify_start') { when { not { @@ -33,7 +38,9 @@ pipeline { } stage('buildandtest') { steps { - sh './gradlew ${GRADLE_ARGS} --refresh-dependencies --continue build test' + withGradle { + sh './gradlew ${GRADLE_ARGS} --refresh-dependencies --continue build test' + } script { env.MYGROUP = sh(returnStdout: true, script: './gradlew properties -q | grep "group:" | awk \'{print $2}\'').trim() env.MYARTIFACT = sh(returnStdout: true, script: './gradlew properties -q | grep "name:" | awk \'{print $2}\'').trim() @@ -47,12 +54,17 @@ pipeline { changeRequest() } } - environment { - FORGE_MAVEN = credentials('forge-maven-forge-user') - } steps { - sh './gradlew ${GRADLE_ARGS} publish -PmavenUser=${FORGE_MAVEN_USR} -PmavenPassword=${FORGE_MAVEN_PSW}' - sh 'curl --user ${FORGE_MAVEN} https://files.minecraftforge.net/maven/manage/promote/latest/${MYGROUP}.${MYARTIFACT}/${MYVERSION}' + withCredentials([usernamePassword(credentialsId: 'maven-forge-user', usernameVariable: 'MAVEN_USER', passwordVariable: 'MAVEN_PASSWORD')]) { + withGradle { + sh './gradlew ${GRADLE_ARGS} publish' + } + } + } + post { + success { + build job: 'filegenerator', parameters: [string(name: 'COMMAND', value: "promote ${env.MYGROUP}:${env.MYARTIFACT} ${env.MYVERSION} latest")], propagate: false, wait: false + } } } } @@ -72,4 +84,4 @@ pipeline { } } } -}
\ No newline at end of file +} |