Skip to content

Instantly share code, notes, and snippets.

@Kjuly
Last active October 3, 2015 19:58
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 Kjuly/2516617 to your computer and use it in GitHub Desktop.
Save Kjuly/2516617 to your computer and use it in GitHub Desktop.
Xcode version management script
#!/bin/bash
cd $PROJECT_DIR
# BUILD_VERSION=`/usr/local/bin/git rev-parse --short HEAD`
BUILD_VERSION=`git rev-parse --short HEAD`
cd $BUILT_PRODUCTS_DIR/$PRODUCT_NAME.app
# Note: It's Info.plist, not Proj-Info.plist
RELEASE_VERSION=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" Info.plist)
/usr/libexec/PlistBuddy -c "Set CFBundleVersion $BUILD_VERSION" Info.plist
# here, 5 is my index of version part in |PreferenceSpecifiers| array
/usr/libexec/PlistBuddy -c "Set :PreferenceSpecifiers:5:DefaultValue $RELEASE_VERSION ($BUILD_VERSION)" Settings.bundle/Root.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment