-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathupdateVersion.sh
executable file
·47 lines (37 loc) · 1.03 KB
/
updateVersion.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
#!/bin/bash
# Load generic functions
. utils.sh
function updatePackageJsonVersion() {
local version=${1}
local clientDirectory=${2}
cd ${clientDirectory}
sed -i "s/\(.*\)\(version\)\(.*\)\"\(.*\)\"\(.*\)/\1\2\3\"${version}\"\5/" package.json
cd -
}
function updatePomVersion() {
local version=${1}
local serverDirectory=${2}
cd ${serverDirectory}
mvn versions:set -DnewVersion=${version} -DgenerateBackupPoms=false
cd -
}
function updateVersion() {
local version=${1}
local clientDirectory="ez-client"
local serverDirectory="ez-server"
updatePackageJsonVersion "${version}" "${clientDirectory}"
updatePomVersion "${version}" "${serverDirectory}"
}
function usage() {
echo -e "${BWhi}updateVersion${RCol} <${BGre}VERSION${RCol}>"
echo -e " ${BGre}VERSION${RCol}: anything you want, usually semver pattern."
echo
echo "This script will update package.json and pom(s) with the given version."
echo
}
if [[ "${1}" == "" ]]; then
error "*** No version specified ***"
usage
exit 1
fi
updateVersion ${@}