-
Notifications
You must be signed in to change notification settings - Fork 0
/
Release-base-pom.groovy
69 lines (63 loc) · 2.56 KB
/
Release-base-pom.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
65
66
67
68
69
@Library('util') _l1
def repository_name = 'flowlogix-maven-central-s01'
def repository_url = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2'
pipeline {
agent any
options {
disableConcurrentBuilds()
}
parameters {
booleanParam(name: 'releaseInMaven', defaultValue: true,
description: 'Whether to release in Maven Central, or just close the repository')
string(name: 'Version', description: 'Version number to release', trim: true)
choice(name: 'releaseToRepo', description: 'Which repository to publish the release',
choices: ['Maven Central', 'Hope Nexus'])
}
stages {
stage('Maven - Release') {
steps {
script {
if (Version.empty) {
def msg = 'Version cannot be empty'
currentBuild.description = msg
error msg
}
if (releaseToRepo.startsWith('Hope')) {
repository_name = 'hope-nexus-artifacts'
repository_url = 'https://nexus.hope.nyc.ny.us/repository/maven-releases'
}
}
gpgSigningCredentials false, {
sh """
export MAVEN_OPTS="\$MAVEN_OPTS -Dsettings.security=$HOME/.m2/settings-security.xml"
mvn -B -ntp -C release:prepare release:perform \
-DpushChanges=false -DlocalCheckout=true \
-DreleaseVersion=$Version -DtagNameFormat=Version-$Version \
-Dgoals=\"resources:resources jar:jar gpg:sign deploy\" \
-Darguments=\"-Dgpg.keyname=\\"Flow Logix, Inc.\\" -Djar.skip-if-empty=true \
-Dmaven.install.skip=true -Dpayara.start.skip=true \
-DaltDeploymentRepository=$repository_name::$repository_url \"
"""
}
}
}
stage('Maven Central - Close (and optionally Release)') {
when {
expression { repository_name != 'hope-nexus-artifacts' }
}
steps {
mavenCentralCredentials {
sh "$HOME/infra/scripts/nexus/maven-central-release.sh com.flowlogix${releaseInMaven.toBoolean() ? ' --release' : ''}"
}
}
}
}
post {
success {
sh "git push origin Version-$Version"
}
failure {
sh "git tag -d Version-$Version || true"
}
}
}