-
Notifications
You must be signed in to change notification settings - Fork 7
/
tg-update-version.sh
executable file
·67 lines (56 loc) · 1.47 KB
/
tg-update-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
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
#!/usr/bin/env bash
# Ensure all parameters are provided
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <new-version>"
exit 1
fi
NEW_VERSION=$1
###########################
###### Definitions ########
###########################
if test -t 1; then
ncolours=$(tput colors)
if test -n "$ncolours" && test $ncolours -ge 8; then
# Define colours
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)"
BLUE="$(tput setaf 4)"
# Define styles
BOLD="$(tput bold)"
UNDERLINE="$(tput smul)"
# Reset style
NORMAL="$(tput sgr0)"
fi
fi
# Function to report errors
error() {
echo ""
echo -e "[${RED}${BOLD}ERROR${NORMAL}] $1"
echo ""
}
# Function to report success
success() {
echo ""
echo -e "[${GREEN}${BOLD}SUCCESS${NORMAL}] $1"
echo ""
}
# Function to report warnings
warn() {
echo ""
echo -e "[${YELLOW}${BOLD}WARN${NORMAL}] $1"
echo ""
}
# Function to report info messages
info() {
echo ""
echo -e "[${BLUE}${BOLD}INFO${NORMAL}] $1"
echo ""
}
###########################
######## Updating #########
###########################
info "Update module versions to ${NEW_VERSION}"
mvn versions:set -DnewVersion=${NEW_VERSION} -DprocessAllModules=true -DgenerateBackupPoms=false && \
mvn versions:commit -DgenerateBackupPoms=false || { error "Failed to update the version to ${NEW_VERSION}."; }
success "Successfully updated version to ${NEW_VERSION}."