forked from MC-Minigames/NoteblockBlitz
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
60 lines (56 loc) · 1.85 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
pipeline {
agent any
tools {
maven 'maven3.5.0'
jdk 'jdk8'
}
stages {
stage ('Initialization') {
steps {
echo 'Preparing for build'
}
}
stage ('Build') {
steps {
sh 'mvn clean install'
archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true
}
post {
failure {
mail to: 'mep_eisen@web.de', subject: 'build of NoteblockBlitz failed', body: 'build of NoteblockBlitz failed'
}
}
}
stage ('Upload') {
steps {
script {
env.BUILDTYPE = readPomVersion().endsWith("-SNAPSHOT") ? "snapshots" : "releases";
}
sh "/srv/hudson/upload_game.sh ${env.BUILDTYPE} target 1 NoteBlockBlitz MGNoteblockBlitz-Plugin"
}
}
stage ('Deploy') {
when {
expression {
currentBuild.result == null || currentBuild.result == 'SUCCESS'
}
}
steps {
sh 'mvn -Dmce.deployment=true -Dmaven.test.skip=true -DskipTests deploy'
}
post {
failure {
mail to: 'mep_eisen@web.de', subject: 'deploy of NoteblockBlitz failed', body: 'deploy of NoteblockBlitz failed'
}
}
}
}
}
def readPomVersion() {
// Reference: http://stackoverflow.com/a/26514030/1851299
sh "mvn --quiet --non-recursive -Dexec.executable='echo' -Dexec.args='\${project.version}' org.codehaus.mojo:exec-maven-plugin:1.3.1:exec > pom.project.version.txt"
pomProjectVersion = readFile('pom.project.version.txt').trim()
sh "rm -f pom.project.version.txt"
echo "Current POM version: ${pomProjectVersion}"
return pomProjectVersion
}