Last active
August 29, 2015 14:14
-
-
Save jokefaker/4abd5eefa54e4f40eae2 to your computer and use it in GitHub Desktop.
Update Xcode build and version numbers from git
This file contains hidden or 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
git=`sh /etc/profile; which git` | |
appBuild=`"$git" rev-list --all |wc -l` | |
appVersion=`"$git" describe --abbrev=0 --tags` | |
# set the commit count as app's build,add branch-name as suffix when using debug model | |
if [ $CONFIGURATION = "Debug" ]; then | |
branchName=`"$git" rev-parse --abbrev-ref HEAD` | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $appBuild-$branchName" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" | |
else | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $appBuild" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" | |
# set the last git tag as app's version | |
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $appVersion" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" | |
fi | |
echo "Updated ${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment