@@ -125,6 +125,10 @@ node {
125
125
// deploy stage only if branch is main or dev
126
126
if (env. BRANCH_NAME == " main" || env. BRANCH_NAME == " dev" ) {
127
127
stage(' deploy' ) {
128
+ // determine project version
129
+ String projectVersion = sh(returnStdout : true , script : " set +x && cd ${ projectName} ; ./gradlew -q " +
130
+ " ${ (env.BRANCH_NAME == "dev") ? "devVersion" : "currentVersion"} " ). toString(). trim()
131
+
128
132
// get the sonatype credentials stored in the jenkins secure keychain
129
133
withCredentials([usernamePassword(credentialsId : mavenCentralCredentialsId, usernameVariable : ' mavencentral_username' , passwordVariable : ' mavencentral_password' ),
130
134
file(credentialsId : mavenCentralSignKeyFileId, variable : ' mavenCentralKeyFile' ),
@@ -135,7 +139,8 @@ node {
135
139
" -Ppassword=${ env.mavencentral_password} " +
136
140
" -Psigning.keyId=${ env.signingKeyId} " +
137
141
" -Psigning.password=${ env.signingPassword} " +
138
- " -Psigning.secretKeyRingFile=${ env.mavenCentralKeyFile} ${ (env.BRANCH_NAME == "dev") ? " -Psnapshot" : ""} "
142
+ " -Psigning.secretKeyRingFile=${ env.mavenCentralKeyFile} " +
143
+ " -PdeployVersion='$projectVersion '"
139
144
140
145
// see https://docs.gradle.org/6.0.1/release-notes.html "Publication of SHA256 and SHA512 checksums"
141
146
def preventSHACheckSums = " -Dorg.gradle.internal.publish.checksums.insecure=true"
@@ -150,9 +155,6 @@ node {
150
155
}
151
156
152
157
// notify rocket chat
153
- String projectVersion =
154
- sh(returnStdout : true , script : " set +x && cd ${ projectName} ; ./gradlew -q printVersion" )
155
- projectVersion = " ${ projectVersion.trim()}${ (env.BRANCH_NAME == "dev") ? "-SNAPSHOT" : ""} "
156
158
String successMsg = " deployment of version $projectVersion from branch '$currentBranchName ' to sonatype " +
157
159
" successful. If this is a deployment from 'main' pls remember visiting https://oss.sonatype.org to " +
158
160
" stag and release artifact!\n " +
0 commit comments