1 | #!/usr/bin/env bash
|
2 | BASEDIR=$(dirname $0)
|
3 |
|
4 | if [[ ! -f $BASEDIR/version_parameters ]]; then
|
5 | echo Missing version_parameters in $BASEDIR
|
6 | echo The file should include these lines \(change value as needed\):
|
7 | echo version_pattern="(?<=VERSION \= \")([0-9.]+)(?=\")"
|
8 | echo check_files=cloudinary-core/src/main/java/com/cloudinary/Cloudinary.java
|
9 | echo change_files="gradle.properties README.md cloudinary-core/src/main/java/com/cloudinary/Cloudinary.java"
|
10 | exit 0
|
11 | fi
|
12 |
|
13 | new_version=$1
|
14 | . $BASEDIR/version_parameters
|
15 | current_version=`grep -oP "$version_pattern" $check_files`
|
16 | current_version_re=${current_version//./\\.}
|
17 | echo $current_version
|
18 | if [ -n "$new_version" ]; then
|
19 | echo "New version will be $new_version"
|
20 | sed -e "s/${current_version_re}/${new_version}/g" -i "" $change_files
|
21 | git changelog -t $new_version
|
22 | else
|
23 | echo "Usage: $0 <new version>"
|
24 | echo "For example: $0 1.9.2"
|
25 | fi
|