Skip to content

Instantly share code, notes, and snippets.

@yhkaplan
Last active July 6, 2020 08:11
Show Gist options
  • Save yhkaplan/c3d12584395152092a989b046975482e to your computer and use it in GitHub Desktop.
Save yhkaplan/c3d12584395152092a989b046975482e to your computer and use it in GitHub Desktop.
#!/usr/bin/env sh
PLIST_BUDDY="/usr/libexec/PlistBuddy"
INFO_PLIST_PATH="app/Info.plist"
CURRENT_FULL_VERSION=$("$PLIST_BUDDY" -c "Print CFBundleVersion" "$INFO_PLIST_PATH")
CURRENT_MARKETING_VERSION=$("$PLIST_BUDDY" -c "Print CFBundleShortVersionString" "$INFO_PLIST_PATH")
ALL_INFO_PLIST_FILES=$(git grep --files-with-matches "CFBundleVersion" -- "*Info.plist")
for INFO_PLIST_FILE in $ALL_INFO_PLIST_FILES; do
# Using this make weird diff: PlistBuddy -c "Set :CFBundleVersion 9.60.0.1"
echo "Setting $INFO_PLIST_FILE"
echo "Full version from $CURRENT_FULL_VERSION to $NEW_FULL_VERSION"
sed -i '' "s/$CURRENT_FULL_VERSION/$NEW_FULL_VERSION/g" "$INFO_PLIST_FILE"
echo "Marketing version from $CURRENT_MARKETING_VERSION to $NEW_MARKETING_VERSION"
echo
sed -i '' "s/$CURRENT_MARKETING_VERSION/$NEW_MARKETING_VERSION/g" "$INFO_PLIST_FILE"
done
@yhkaplan
Copy link
Author

yhkaplan commented Jul 6, 2020

Usage: NEW_MARKETING_VERSION="11.0.0" NEW_FULL_VERSION="11.0.0.3" ./bin/set_version.sh

This script is for when you can't use agvtool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment