forked from rundeck/rundeck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rd_versions.sh
43 lines (32 loc) · 1006 Bytes
/
rd_versions.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
34
35
36
37
38
39
40
#!/bin/bash
#/ utility functions for versioning
rd_get_version(){
local CUR_VERSION=$(grep version.number= `pwd`/version.properties | cut -d= -f 2)
local CUR_RELEASE=$(grep version.release.number= `pwd`/version.properties | cut -d= -f 2)
local CUR_TAG=$(grep version.tag= `pwd`/version.properties | cut -d= -f 2)
echo "${CUR_VERSION}"
echo "${CUR_RELEASE}"
echo "${CUR_TAG}"
}
rd_make_release_version(){
local VERS=("$@")
let relvers=$(( 1 + ${VERS[1]} ))
echo "${VERS[0]}"
echo "$relvers"
echo "GA"
}
rd_make_next_snapshot(){
local VERS=("$@")
local -a PARTS=()
IFS='.' read -ra PARTS <<< "${VERS[0]}"
PARTS[2]=$(( ${PARTS[2]} + 1 ))
local val=$( O=$IFS ; IFS='.' ; local X="${PARTS[*]}" ; OFS=$O ; echo "$X" )
echo "$val"
echo "0"
echo "SNAPSHOT"
}
rd_set_version(){
local FARGS=("$@")
echo "Setting version to ${FARGS[0]}-${FARGS[1]}-${FARGS[2]}"
local result=$( bash setversion.sh "${FARGS[@]}" 2>&1 )
}