1#!/bin/bash 2 3if [ "$#" -ne 2 ] 4 then 5 echo "Use: ./bump-version old_version new_version" 6 exit 7fi 8 9old_version=$1 10new_version=$2 11 12update_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 18update_version "README.md" 19update_version "kotlinx-coroutines-core/README.md" 20update_version "kotlinx-coroutines-debug/README.md" 21update_version "kotlinx-coroutines-test/README.md" 22update_version "ui/coroutines-guide-ui.md" 23update_version "gradle.properties" 24update_version "integration-test/gradle.properties" 25 26# Escape dots, e.g. 1.0.0 -> 1\.0\.0 27escaped_old_version=$(echo $old_version | sed s/[.]/\\\\./g) 28result=$(find ./ -type f \( -iname \*.properties -o -iname \*.md \) | grep -v "\.gradle" | grep -v "build" | xargs -I{} grep -H "$escaped_old_version" {} | grep -v CHANGES.md | grep -v COMPATIBILITY.md) 29if [ -z "$result" ]; 30then 31 echo "Done" 32else 33 echo "ERROR: Previous version is present in the project: $result" 34 exit -1 35fi 36