-
Notifications
You must be signed in to change notification settings - Fork 0
/
Release-shrinkwrap-resolver.groovy
64 lines (59 loc) · 1.76 KB
/
Release-shrinkwrap-resolver.groovy
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
@Library('util') _l1
def tag_name = ""
pipeline {
agent any
options {
disableConcurrentBuilds()
}
parameters {
string(name: 'Version', description: 'Version number to release', trim: true)
}
stages {
stage('Maven Info') {
steps {
script {
if (Version.empty) {
def msg = 'Version cannot be empty'
currentBuild.description = msg
error msg
}
tag_name = "shrinkwrap-resolver-$Version"
}
sh "mvn -V -N -B -ntp -C help:all-profiles"
script {
currentBuild.description = "Commit ${env.GIT_COMMIT[0..7]} Node $env.NODE_NAME"
}
}
}
stage('Maven - Update Versions') {
steps {
sh """
mvn -B -ntp -C versions:set -DprocessAllModules=true -DgenerateBackupPoms=false -DnewVersion=$Version versions:set
git commit -am "[Release Version]"
"""
}
}
stage('Tag Release') {
steps {
sh "git tag $tag_name"
}
}
stage('Maven - Deploy') {
steps {
sh """
mvn -B -ntp -C -Dmaven.install.skip=true -DtrimStackTrace=false -DskipTests \
-DaltDeploymentRepository=hope-nexus-artifacts::default::https://nexus.hope.nyc.ny.us/repository/maven-releases/ \
deploy
"""
}
}
}
post {
success {
sh "git push origin $tag_name"
}
failure {
sh "git tag -d $tag_name || true"
}
}
}