forked from alipay/ams-java-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bump_version.sh
executable file
·30 lines (24 loc) · 943 Bytes
/
bump_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
#!/bin/bash
shopt -s expand_aliases
if [ ! -n "$1" ] ;then
echo "Please enter a version"
exit 1
else
echo "The new version is $1 !"
fi
currentVersion=`sed -n '/<project /,/<name/p' pom.xml | grep version | cut -d '>' -f2 | cut -d '<' -f1`
echo "The current version is $currentVersion"
if [ `uname` == "Darwin" ] ;then
echo "This is OS X"
alias sed='sed -i ""'
else
echo "This is Linux"
alias sed='sed -i'
fi
sed "/<project /,/<name>/ s/<version>.*<\/version>/<version>$1<\/version>/" pom.xml
echo "DONE: pom.xml"
sed "s/sdkVersion = \".*\";/sdkVersion = \"$1.`date "+%Y%m%d"`\";/" src/main/java/com/alipay/ams/cfg/AMSSettings.java
echo "DONE: ./src/main/java/com/alipay/ams/cfg/AMSSettings.java"
sed "s/<version>.*<\/version>/<version>$1<\/version>/" README.md
sed "s/\"com.alipay.ams:ams-java:.*\"/\"com.alipay.ams:ams-java:$1\"/" README.md
echo "DONE: README.md"