Bimba.git

commit e4d7079147c16b0d67cd39e35f5d943644d24c68

Author: Adam Evyčędo <git@apiote.xyz>

adapt release script to kotlin build script

 release.sh | 16 ++++++++--------


diff --git a/release.sh b/release.sh
index aa6d0ce73903de6cd4504626e025f7fdbcfd2fc2..62122ff378c7bd472d9e463b2b145ef1637b4669 100755
--- a/release.sh
+++ b/release.sh
@@ -71,11 +71,11 @@ 			exit 1
 		fi
 	done
 
-	currentVersionName=$(grep -E 'versionName "[0-9\.]+"' app/build.gradle | tr -s ' ' | cut -d ' ' -f3 | tr -d '"')
+	currentVersionName=$(grep -Eo 'versionName = "[0-9\.]+"' app/build.gradle.kts | cut -d '=' -f2 | tr -d ' "')
 	major=$(echo "$currentVersionName" | cut -d '.' -f1)
 	minor=$(echo "$currentVersionName" | cut -d '.' -f2)
 	patch=$(echo "$currentVersionName" | cut -d '.' -f3)
-	currentVersionCode=$(grep 'versionCode' app/build.gradle | tr -s ' ' | cut -d ' ' -f3)
+	currentVersionCode=$(grep 'versionCode' app/build.gradle.kts | cut -d '=' -f2 | tr -d ' ')
 
 	case $releaseType in
 		major) newVersionName="$((major + 1)).0.0" ;;
@@ -85,16 +85,16 @@ 		*) echo "wrong release type given"; exit 1 ;;
 	esac
 	newVersionCode=$((currentVersionCode + 1))
 
-	sed -i "s/versionName \"$currentVersionName\"/versionName \"$newVersionName\"/" app/build.gradle
-	sed -i "s/versionCode $currentVersionCode/versionCode $newVersionCode/" app/build.gradle
+	sed -i "s/versionName = \"$currentVersionName\"/versionName = \"$newVersionName\"/" app/build.gradle.kts
+	sed -i "s/versionCode = $currentVersionCode/versionCode = $newVersionCode/" app/build.gradle.kts
 
 	git shortlog "v${currentVersionName}..HEAD" >> "metadata/en-US/changelogs/$newVersionCode.txt"
 
 	echo "time to update changelogs"
 elif [ $phase -eq 1 ]
 then
-	newVersionName=$(grep -E 'versionName "[0-9\.]+"' app/build.gradle | tr -s ' ' | cut -d ' ' -f3 | tr -d '"')
-	newVersionCode=$(grep 'versionCode' app/build.gradle | tr -s ' ' | cut -d ' ' -f3)
+	newVersionName=$(grep -Eo 'versionName = "[0-9\.]+"' app/build.gradle.kts | cut -d '=' -f2 | tr -d ' "')
+	newVersionCode=$(grep 'versionCode' app/build.gradle.kts | cut -d '=' -f2 | tr -d ' ')
 	if ! find metadata -type d -name changelogs -print0 | xargs -0 -I{} [ -f "{}/$newVersionCode.txt" ]
 	then
 		echo "not all languages have changelog"
@@ -104,7 +104,7 @@ 		if [ "$yn" != 'y' ] && [ "$yn" != 'Y' ]; then
 			exit 1
 		fi
 	fi
-	git add app/build.gradle
+	git add app/build.gradle.kts
 	git add metadata/
 	git commit -S -m "release version $newVersionName ($newVersionCode)" || true
 	echo 'pushing …'
@@ -129,7 +129,7 @@ 	git switch develop
 	git merge master
 elif [ $phase -eq 2 ]
 then
-	newVersionName=$(grep -E 'versionName "[0-9\.]+"' app/build.gradle | tr -s ' ' | cut -d ' ' -f3 | tr -d '"')
+	newVersionName=$(grep -Eo 'versionName = "[0-9\.]+"' app/build.gradle.kts | cut -d '=' -f2 | tr -d ' "')
 	git tag -s -m "v${newVersionName}" "v${newVersionName}"
 	git push origin --tags
 	git switch develop