Skip to content

Instantly share code, notes, and snippets.

@aggieben
Created May 17, 2011 19:26
Show Gist options
  • Save aggieben/977185 to your computer and use it in GitHub Desktop.
Save aggieben/977185 to your computer and use it in GitHub Desktop.
Xcode RunScript to insert git-ish version string into bundle version property in Info.plist
echo "majorMinor=`/usr/libexec/PlistBuddy -c \"Print :CFBundleVersion\" \"${PROJECT_DIR}/${PROJECT_NAME}-Info.plist\"`"
majorMinor=`/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" "${PROJECT_DIR}/${PROJECT_NAME}-Info.plist"`
echo "build=`git describe --match ${majorMinor}* --tags --dirty=+ | sed \"s/\(${majorMinor}\)\(.*\)/\2/\"`"
build=`git describe --match ${majorMinor}* --tags --dirty=+ | sed "s/\(${majorMinor}\)\(.*\)/\2/"`
echo "/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion ${majorMinor}.${build}\" \"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}\""
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${majorMinor}.${build}" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment