aboutsummaryrefslogtreecommitdiff
path: root/Jenkinsfile
diff options
context:
space:
mode:
authorSciWhiz12 <arnoldnunag12@gmail.com>2021-05-15 11:23:10 +0800
committerSciWhiz12 <arnoldnunag12@gmail.com>2021-05-15 11:23:10 +0800
commit6218dc6442d90e7fa0e385b39ef1dbd8c36b9a1d (patch)
treebcfca60898175ac4e2f06e54962c5bc0e82091e7 /Jenkinsfile
parent1f0dc02a5dc7ca7473c387f8a391d7c21cf96baa (diff)
downloadArtifactural-6218dc6442d90e7fa0e385b39ef1dbd8c36b9a1d.tar.gz
Artifactural-6218dc6442d90e7fa0e385b39ef1dbd8c36b9a1d.tar.bz2
Artifactural-6218dc6442d90e7fa0e385b39ef1dbd8c36b9a1d.zip
Update Jenkinsfile
Based off of ForgeGradle's Jenkinsfile.
Diffstat (limited to 'Jenkinsfile')
-rw-r--r--Jenkinsfile30
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
+}