Last active
March 10, 2021 07:10
-
-
Save kibotu/ffbf2d0c329db525967614172bb5383b to your computer and use it in GitHub Desktop.
Extracting app version from version-properties.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo ">> Step: Extracting app version from versions.properties. <<" | |
if [ -f "version-properties.gradle" ]; then | |
APP_VERSION_RAW=$(grep "appVersion *=" version-properties.gradle) | |
else | |
echo "Could not detect version-properties.grade file, aborting..." | |
exit 1 | |
fi | |
APP_VERSION=$(echo "$APP_VERSION_RAW" | sed 's/[ \"]//g' | awk -F '[=]' '{print $2}') | |
APP_MAJOR=$(echo "$APP_VERSION_RAW" | sed 's/[ \"]//g' | awk -F '[.=/#]' '{print $2}') | |
APP_MINOR=$(echo "$APP_VERSION_RAW" | sed 's/[ \"]//g' | awk -F '[.=/#]' '{print $3}') | |
APP_HOTFIX_VERSION=$(echo "$APP_VERSION_RAW" | sed 's/[ \"]//g' | awk -F '[.=/#]' '{print $4}') | |
APP_BUILD_NUMBER=$(echo "$APP_VERSION_RAW" | sed 's/[ \"]//g' | awk -F '[.=/#]' '{print $5}') | |
if [[ -z $HOTFIX_VERSION ]]; then | |
APP_HOTFIX_VERSION=0 | |
fi | |
if [[ -z $BUILD_NUMBER ]]; then | |
APP_BUILD_NUMBER=0 | |
fi | |
export BUILD_BRANCH="release/${APP_MAJOR}.${APP_MINOR}.${APP_HOTFIX_VERSION}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ext { | |
/** | |
* This is the (external) app version. | |
* It will be used e.g. to: load the gradle script, load the app settings, etc. | |
* | |
* This parameter is mandatory. | |
*/ | |
appVersion="3.13.0.0" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
prints release/1.0.0