Skip to content

Instantly share code, notes, and snippets.

@bensig
Created January 17, 2022 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bensig/013ee535efd81a939c512326e732ba80 to your computer and use it in GitHub Desktop.
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
#!/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