-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathReleaseJenkinsfile
68 lines (58 loc) · 1.9 KB
/
ReleaseJenkinsfile
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
properties(
[
pipelineTriggers([
triggers: [
[
$class: 'hudson.triggers.SCMTrigger',
scmpoll_spec : 'H 0 * * 0'
]
]
])
]
)
node {
def descriptor
def releaseVersion
stage ('Clone') {
checkout scm
sh '''git checkout dev'''
result = sh (script: "git log -1 | grep '\\[ci skip\\]'", returnStatus: true)
if (result == 0) {
currentBuild.result = 'SUCCESS'
return
}
}
stage ('Modify version') {
descriptor = Artifactory.mavenDescriptor()
pom = readMavenPom file: 'pom.xml'
releaseVersion = pom.version.split('-')[0]
descriptor.version = releaseVersion
descriptor.failOnSnapshot = true
descriptor.transform()
}
stage ('Make release') {
withMaven (maven: 'M3', mavenSettingsConfig: 'maven-settings', options: [artifactsPublisher(disabled: true)]) {
sh 'mvn -DskipTests clean deploy -Ppublication,gpg'
}
}
stage ('Update repository') {
sh '''git add .'''
def commitReleaseScript = "git commit -m \"updating poms for " + releaseVersion + " release [ci skip]\""
sh commitReleaseScript
def tagScript = "git tag " + releaseVersion
sh tagScript
def splittedVersion = releaseVersion.split('\\.')
splittedVersion[2] = (splittedVersion[2].toInteger() + 1) as String
def newSnapshotVersion = splittedVersion.join('.') + '-SNAPSHOT'
descriptor.version = newSnapshotVersion
descriptor.failOnSnapshot = false
descriptor.transform()
sh '''git add .'''
def commitSnapshotScript = "git commit -m \"updating poms for " + newSnapshotVersion + " development [ci skip]\""
sh commitSnapshotScript
sshagent(['cf816ae4-a98e-4eaa-98fd-18c588739711']) {
sh '''git push origin dev'''
sh '''git push --tags'''
}
}
}