-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile.release
76 lines (72 loc) · 2.7 KB
/
Jenkinsfile.release
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
pipeline {
agent any
options { timestamps() }
stages {
stage('Checkout') {
steps {
withCredentials(
[usernamePassword(credentialsId: 'CSchemmy',
usernameVariable: 'gitUser',
passwordVariable: 'gitPwd'
)]) {
sh "rm -rf target"
sh "git clone https://${gitUser}:${gitPwd}@${gitUrl.split('://')[1]} target"
}
}
}
stage('Build release') {
steps{
script {
dir( path: 'target') {
sh "git config user.email '[email protected]'"
sh "git config user.name 'Jenkins Release Job'"
sh "git checkout develop"
mvn("com.amashchenko.maven.plugin:gitflow-maven-plugin:release-start " + getVersionDigitToIncrement())
pom = readMavenPom file: 'pom.xml'
mvn ("build-helper:parse-version versions:set -DnewVersion=${pom.version} versions:commit -f pom-aar.xml")
sh "git commit -a -m 'Update aar versions for release'"
mvn("com.amashchenko.maven.plugin:gitflow-maven-plugin:release-finish")
pom = readMavenPom file: 'pom.xml'
mvn ("build-helper:parse-version versions:set -DnewVersion=${pom.version} versions:commit -f pom-aar.xml")
sh "git commit -a -m 'Update for next development version for aar'"
sh "git push"
}
}
}
}
stage('trigger jobs') {
steps {
build job: 'lbds-android-messaging', wait: false
}
}
}
post {
always {
script {
dir( path: 'target') {
sh "git checkout master"
pom = readMavenPom file: 'pom.xml'
addHtmlBadge(html: "<br>release version: ${pom.version}")
}
}
}
}
}
def getVersionDigitToIncrement() {
if(params.versionDigitToIncrement == "major") {
return "-DversionDigitToIncrement=0";
} else if(params.versionDigitToIncrement == "minor") {
return "-DversionDigitToIncrement=1";
} else {
return "-DversionDigitToIncrement=2";
}
}
def mvn(param) {
withMaven(
// globalMavenSettingsConfig: 'GlobalSettingsNexus',
options: [openTasksPublisher(disabled: true)],
mavenOpts: '-Xmx1536m -Xms512m',
maven: 'maven-3.6.3') {
sh "mvn -U -B -e ${param}"
}
}