From dec0a246f248dbf7c9199ff19c50062f5ae336b4 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sat, 26 Jan 2019 16:27:48 +0000 Subject: Rewrite the Jenkinsfile to use the new declarative pipeline syntax, lets hope it still works. This will only push to maven on the master branch now. --- Jenkinsfile | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 655deb3..abc157c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,15 +1,26 @@ -node { - stage 'Checkout' +pipeline { + agent any + stages { - checkout scm + stage ('Build') { + steps { + sh "rm -rf build/libs/" + sh "chmod +x gradlew" + sh "./gradlew build" - stage 'Build' + archiveArtifacts artifacts: '**/build/libs/*.jar', fingerprint: true + } + } - sh "rm -rf build/libs/" - sh "chmod +x gradlew" - sh "./gradlew build" + stage ('Archive artifacts') { + //Only publish to maven when on master branch + when { + branch 'master' + } + steps { + sh "./gradlew upload" + } + } - stage "Archive artifacts" - - sh "./gradlew upload" -} + } +} \ No newline at end of file -- cgit v1.2.3