Forked from bakertim/gist:68a4c5778fb561ea34a4
Last active
February 16, 2024 15:55
-
-
Save rijieli/58abc113d032bd48ddd815b65d853582 to your computer and use it in GitHub Desktop.
Set iOS Build Number to Git Commit Count
This file contains 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
# source http://blog.jaredsinclair.com/post/97193356620/the-best-of-all-possible-xcode-automated-build | |
# | |
# Set the build number to the current git commit count. | |
# If we're using the Dev scheme, then we'll suffix the build | |
# number with the current branch name, to make collisions | |
# far less likely across feature branches. | |
# Based on: http://w3facility.info/question/how-do-i-force-xcode-to-rebuild-the-info-plist-file-in-my-project-every-time-i-build-the-project/ | |
# | |
git=`sh /etc/profile; which git` | |
appBuild=`"$git" rev-list --all |wc -l` | |
if [ $CONFIGURATION = "Debug" ]; then | |
# Do No Thing | |
else | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $appBuild" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment