Skip to content

Instantly share code, notes, and snippets.

@Sweekriti91
Created August 24, 2023 22:43
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 Sweekriti91/f63db968560f8bf866c152049bf2a70e to your computer and use it in GitHub Desktop.
Save Sweekriti91/f63db968560f8bf866c152049bf2a70e to your computer and use it in GitHub Desktop.
bash script Version Changes for CI
#!/usr/bin/env bash
#
# For Xamarin Android or iOS, change the version name located in AndroidManifest.xml and Info.plist.
# IMPORTANT, SET VALUES FOR : $VERSION_NAME, ANDROID_MANIFEST_FILE,INFO_PLIST_FILE
if [ -z "$VERSION_NAME" ]
then
echo "You need define the VERSION_NAME environment variable"
exit
fi
ANDROID_MANIFEST_FILE=<PATH_TO_AndroidManifest.xml>
INFO_PLIST_FILE=<PATH_TO_info.plist>
if [ -e "$ANDROID_MANIFEST_FILE" ]
then
echo "Updating version name to $VERSION_NAME in AndroidManifest.xml"
sed -i '' 's/versionName="[0-9.]*"/versionName="'$VERSION_NAME'"/' $ANDROID_MANIFEST_FILE
echo "File content:"
cat $ANDROID_MANIFEST_FILE
fi
if [ -e "$INFO_PLIST_FILE" ]
then
echo "Updating version name to $VERSION_NAME in Info.plist"
plutil -replace CFBundleShortVersionString -string $VERSION_NAME $INFO_PLIST_FILE
echo "File content:"
cat $INFO_PLIST_FILE
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment