forked from oaplatform/oap-storage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversion.sh
33 lines (23 loc) · 846 Bytes
/
version.sh
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
#!/bin/bash
set -x
BUILD_COUNTER=$1
PROJECT_NAME=$2
BRANCH_NAME=$3
VERSION_XENOSS=$(grep -oP 'project\.version\>\K[^<]*' pom.xml)
if [ "$BRANCH_NAME" == "master" ] || [ "$BRANCH_NAME" == "" ] || [ "$BRANCH_NAME" == "refs/heads/master" ]; then
VERSION_BRANCH=""
MAVEN_BUILD_COUNTER=""
else
VERSION_BRANCH="-${BRANCH_NAME}"
MAVEN_BUILD_COUNTER="-${BUILD_COUNTER}"
fi
set +x
#project name
echo "##teamcity[setParameter name='oap.project.name' value='${PROJECT_NAME,,}']"
#maven master
echo "##teamcity[setParameter name='${PROJECT_NAME,,}.project.version' value='${VERSION_XENOSS}']"
#maven branch
echo "##teamcity[setParameter name='oap.project.version.branch' value='${VERSION_XENOSS}${VERSION_BRANCH}${MAVEN_BUILD_COUNTER}']"
#teamcity
set +x
echo "##teamcity[buildNumber '${VERSION_XENOSS}${VERSION_BRANCH}-${BUILD_COUNTER}']"