-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRelease-apache-shiro.groovy
More file actions
76 lines (71 loc) · 2.87 KB
/
Copy pathRelease-apache-shiro.groovy
File metadata and controls
76 lines (71 loc) · 2.87 KB
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
@Library('util') _l1
def tag_name = ""
def nexus_staging_profile = ""
def alt_repository = ""
def altReleaseFlags = ""
pipeline {
agent any
options {
disableConcurrentBuilds()
}
parameters {
booleanParam(name: 'createTag', defaultValue: true,
description: 'Whether to create tag in GitHub')
string(name: 'Version', description: 'Version number to release', trim: true)
choice(name: 'releaseToRepo', description: 'Which repository to publish the release',
choices: ['Maven Central', 'FlowLogix Nexus'])
}
stages {
stage('Maven Info') {
steps {
script {
if (Version.empty) {
def msg = 'Version cannot be empty'
currentBuild.description = msg
error msg
}
if (releaseToRepo.startsWith('FlowLogix')) {
alt_repository = "-DaltDeploymentRepository=flowlogix-nexus-artifacts::https://nexus.flowlogix.com/repository/maven-releases"
altReleaseFlags = "-DdistMgmtReleasesId=flowlogix-nexus-artifacts -DdistMgmtReleasesName=FlowLogixJenkins \
-DdistMgmtReleasesUrl=https://nexus.flowlogix.com/repository/maven-releases"
} else {
// nexus_staging_profile = "nexus-staging"
alt_repository = "-DaltDeploymentRepository=apache.releases.https::https://repository.apache.org/service/local/staging/deploy/maven2"
}
tag_name = "shiro-root-$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 - Release') {
steps {
mavenSettingsCredentials true, {
sh """
export MAVEN_OPTS="\$MAVEN_OPTS $altReleaseFlags $alt_repository"
mvn -B -ntp -C release:prepare release:perform -Pskip_jakarta_ee_tests \
-Dnexus-staging-profile=$nexus_staging_profile $altReleaseFlags \
-DreleaseVersion=$Version -Darguments=\"-DtrimStackTrace=false -Dmaven.install.skip=true \
$alt_repository\" \
"""
}
}
}
}
post {
success {
script {
if (createTag.toBoolean() && releaseToRepo.startsWith('Maven')) {
sh "git push origin $tag_name"
} else {
sh "git tag -d $tag_name || true"
}
}
}
failure {
sh "git tag -d $tag_name || true"
}
}
}