forked from amuniz/webhook-relay-plugin
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathJenkinsfile
63 lines (48 loc) · 1.4 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
61
62
63
pipeline {
agent any
parameters {
booleanParam(name: 'TRIGGER_RELEASE', defaultValue: false, description: 'Trigger a Maven release')
}
tools {
maven 'mvn-3.9.9'
jdk 'jdk17'
}
options {
timeout(time: 30, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr: "30"))
timestamps()
}
stages {
stage("Build") {
when {
expression { params.TRIGGER_RELEASE == false }
}
steps {
withMaven(globalMavenSettingsConfig: 'maven-settings-nexus-internal-ci-build-jobs', jdk: 'jdk17', maven: 'mvn-3.9.9') {
sh "mvn clean install --batch-mode"
}
}
}
stage("Release") {
when {
branch 'master'
expression { params.TRIGGER_RELEASE == true }
}
steps {
script {
pom = readMavenPom file: 'pom.xml'
def releaseVersion = pom.version.replaceAll('-SNAPSHOT', "")
currentBuild.description = "Release: ${releaseVersion}"
deleteDir()
checkout scm
sh "git checkout $BRANCH_NAME"
withMaven(globalMavenSettingsConfig: 'maven-settings-nexus-internal-ci-build-jobs', jdk: 'jdk17', maven: 'mvn-3.9.9') {
sshagent(['jenkins-ops.github-organizations-plugin']) {
sh "mvn release:clean release:prepare release:perform --batch-mode"
}
}
}
}
}
}
}