#!/bin/sh # global env MODULE_NAME="legacy" BUILD_GRADLE_FILE="build.gradle.kts" TRACK=$1 USER_FRACTION=$2 if [ "$#" -lt 1 ]; then echo "Illegal number of parameters - required" echo "1st argument for --track e.g: internal, alpha, beta or production" echo "2nd argument for --user-fraction e.g: 0.1 = 10%; 0.25 = 25%; 1 = 100%" exit fi export VERSION_NAME=`egrep '^[[:blank:]]+versionName[[:blank:]]' ${MODULE_NAME}/${BUILD_GRADLE_FILE} | awk '{print $3}' | sed s/\"//g` export VERSION_CODE=`egrep '^[[:blank:]]+versionCode[[:blank:]]' ${MODULE_NAME}/${BUILD_GRADLE_FILE} | awk '{print $3}' | sed s/\"//g` # 01. bumper versionCode & versionName with gradle task # 02. check for the information (receive user input) # git ls/info || git status # 03a. (BETA RELEASE) checkout & annotate with git tag git checkout -b release/${VERSION_NAME} git tag -a $VERSION_NAME -m "beta release to play store for ${VERSION_NAME} (${VERSION_CODE})" # 03b. (HOTFIX RELEASE) checkout & annotate with git tag git checkout -b hotfix/${VERSION_NAME} git tag -a $VERSION_NAME -m "hotfix release to play store for ${VERSION_NAME} (${VERSION_CODE})" # 04. git add modified gradle file + git push new branch & tag git add ${MODULE_NAME}/${BUILD_GRADLE_FILE} # 04a. commit+push for beta release git commit -m "beta release to play store for ${VERSION_NAME} (${VERSION_CODE})" git push -u origin release/${VERSION_NAME} && git push origin ${VERSION_NAME} # 04b. commit+push for hotfix release git commit -m "hotfix release to play store for ${VERSION_NAME} (${VERSION_CODE})" git push -u origin hotfix/${VERSION_NAME} && git push origin ${VERSION_NAME} # 05. auto-publish the AAB # ./gradlew publishProdReleaseBundle --track=$TRACK --user-fraction=$USER_FRACTION