#1482 - Properly collection version for CI jobs.
This commit is contained in:
6
Jenkinsfile
vendored
6
Jenkinsfile
vendored
@@ -123,12 +123,8 @@ pipeline {
|
||||
|
||||
steps {
|
||||
script {
|
||||
// Warm up this plugin quietly before using it.
|
||||
sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -q org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version'
|
||||
|
||||
// Extract project's version number
|
||||
PROJECT_VERSION = sh(
|
||||
script: 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version -o | grep -v INFO',
|
||||
script: "ci/version.sh",
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
||||
|
||||
@@ -21,5 +21,5 @@ MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw \
|
||||
-Dmaven.test.skip=true \
|
||||
-Dgpg.passphrase=${PASSPHRASE} \
|
||||
-Dgpg.secretKeyring=${GNUPGHOME}/secring.gpg \
|
||||
-DstagingDescription="Releasing ${PROJECT_VERSION}" \
|
||||
-DstagingDescription="Releasing Spring HATEOAS ${PROJECT_VERSION}" \
|
||||
clean deploy -B
|
||||
14
ci/version.sh
Executable file
14
ci/version.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
RAW_VERSION=`MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw \
|
||||
org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate \
|
||||
-Dexpression=project.version -q -DforceStdout`
|
||||
|
||||
# Split things up
|
||||
VERSION_PARTS=($RAW_VERSION)
|
||||
|
||||
# Grab the last part, which is the actual version number.
|
||||
echo ${VERSION_PARTS[${#VERSION_PARTS[@]}-1]}
|
||||
|
||||
Reference in New Issue
Block a user