Vsevolod Tolstopyatov | a6199a8 | 2018-10-08 18:01:12 +0300 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | if [ "$#" -ne 2 ] |
| 4 | then |
| 5 | echo "Use: ./bump-version old_version new_version" |
| 6 | exit |
| 7 | fi |
| 8 | |
| 9 | old_version=$1 |
| 10 | new_version=$2 |
| 11 | |
| 12 | update_version() { |
| 13 | echo "Updating version from '$old_version' to '$new_version' in $1" |
| 14 | sed -i.bak s/$old_version/$new_version/g $1 |
| 15 | rm $1.bak |
| 16 | } |
| 17 | |
| 18 | update_version "README.md" |
| 19 | update_version "ui/coroutines-guide-ui.md" |
| 20 | update_version "ui/coroutines-guide-ui.md" |
| 21 | update_version "native/README.md" |
| 22 | update_version "ui/kotlinx-coroutines-android/example-app/gradle.properties" |
| 23 | update_version "ui/kotlinx-coroutines-android/animation-app/gradle.properties" |
| 24 | update_version "gradle.properties" |
| 25 | |
| 26 | result=$(find ./ -type f \( -iname \*.properties -o -iname \*.md \) | grep -v "\.gradle" | grep -v "build" | xargs -I{} grep -H "$old_version" {} | grep -v CHANGES.md) |
| 27 | if [ -z "$result" ]; |
| 28 | then |
| 29 | echo "Done" |
| 30 | else |
| 31 | echo "Previous version is present in the project: $result" |
| 32 | |
| 33 | fi |