Created
January 17, 2022 06:19
-
-
Save bensig/013ee535efd81a939c512326e732ba80 to your computer and use it in GitHub Desktop.
Script to compare the local version of Info.plist and app/build.gradle to the released version on the AppStore and Play Store
This file contains hidden or 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
#!/bin/bash | |
# check versions in Info.plist and app/build.gradle | |
# compare to public releases on both apple and google stores | |
#variables | |
PLIST=`find ./ios -name "Info.plist"` | |
GRADLE=`find ./android/app -name "build.gradle"` | |
APP_ID="com.yourapp.app" | |
GAPP_ID="com.yourapp.app" | |
# announcement | |
echo | |
echo "This script checks the version numbers in $PLIST and $GRADLE compared to the released versions." | |
echo | |
# get current versions | |
echo "Getting local version numbers..." | |
androidVersion=`cat $GRADLE |grep -m1 "versionName" | cut -d'"' -f2 | tr -d ';' | tr -d ' '` | |
iosVersion=`plutil -p $PLIST|grep CFBundleShortVersionString | cut -d ">" -f2|cut -d'"' -f2` | |
# show local versions | |
echo "Local iOS Version: $iosVersion" | |
echo "Local Android Version: $androidVersion" | |
echo | |
if [[ "$iosVersion" != "$androidVersion" ]]; then | |
echo "Different versions detected between iOS and Android. You may want to synchronize these with ./versionUpdate.sh " | |
else | |
echo "Versions are synchronized on iOS and Android. " | |
fi | |
echo | |
# show released versions | |
echo "Getting released version numbers..." | |
iosRelease=`curl -s http://itunes.apple.com/us/lookup\?bundleId\=$APP_ID | jq '.results | .[] | .version'| cut -d'"' -f2` | |
androidRelease=`curl -s "https://play.google.com/store/apps/details?id=$GAPP_ID" | sed -n 's|[^<]*<span class="htlgb">\([^<]*\)</span>[^<]*|\1\n|gp'|grep Version|tail -c 6` | |
echo "Released iOS Version: $iosRelease" | |
echo "Released Android Version: $androidRelease" | |
echo | |
[[ "$iosVersion" = "$iosRelease" ]] && echo "Local iOS version matches release." || echo "Local iOS version does not match release." | |
[[ "$androidVersion" = "$androidRelease" ]] && echo "Local Android version matches release." || echo "Local Android version does not match release." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment