UNPKG

895 Bapplication/x-shView Raw
1#!/usr/bin/env bash
2BASEDIR=$(dirname $0)
3
4if [[ ! -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
11fi
12
13new_version=$1
14. $BASEDIR/version_parameters
15current_version=`grep -oP "$version_pattern" $check_files`
16current_version_re=${current_version//./\\.}
17echo $current_version
18if [ -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
22else
23 echo "Usage: $0 <new version>"
24 echo "For example: $0 1.9.2"
25fi