Created
August 24, 2023 22:43
-
-
Save Sweekriti91/f63db968560f8bf866c152049bf2a70e to your computer and use it in GitHub Desktop.
bash script Version Changes for CI
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 | |
# | |
# 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