Skip to content

Instantly share code, notes, and snippets.

@radianttap
Created September 12, 2014 10:11
Show Gist options
  • Save radianttap/804b57c4eb5e72191cc3 to your computer and use it in GitHub Desktop.
Save radianttap/804b57c4eb5e72191cc3 to your computer and use it in GitHub Desktop.
Xcode versioning based on git tags and number of builds
# Get the version number from the tag in git and the number of commits as the build number
#
appVersion=$(git describe --long | cut -f 1 -d "-")
appBuild=$(git describe --long | cut -f 2 -d "-")
#gitHash=$(git describe --long | cut -f 3 -d "-")
echo "From GIT Version = $appVersion Build = $appBuild"
#
# Set the version info in plist file
#
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $appVersion" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $appBuild" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
#/usr/libexec/PlistBuddy -c "Set :GITHash $gitHash" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
echo "Updated ${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
@radianttap
Copy link
Author

It's picked up from here: http://stackoverflow.com/a/16332406/108859

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