Created
December 12, 2013 18:04
-
-
Save ericholsinger/7932505 to your computer and use it in GitHub Desktop.
This is a script for incrementing build numbers in xcode, automatically during the build phase. It handles the build in the format xx.yy.zz where zz is incremented for each build, and yy is incremented when you archive your project. The xx is handled manually in this case. For more information, you can read my blog post at http://bit.ly/1h3ztJK …
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
#!/bin/bash | |
conf=${CONFIGURATION} | |
arch=${ARCHS:0:4} | |
# Only increase the build number on Device and AdHoc/AppStore build | |
if [ $conf == "Release" ] | |
then | |
echo "Bumping bundle version number..." | |
buildPlist=${INFOPLIST_FILE} | |
bundleVersion=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$buildPlist" | /usr/bin/perl -pe 's/(\d+\.)(\d+)(\.\d+)/$1.($2+1).$3/eg'` | |
echo $bundleVersion; | |
/usr/libexec/PListBuddy -c "Set :CFBundleVersion $bundleVersion" "$buildPlist" | |
echo "Bumping bundle short version number..." | |
bundleShortVersion=`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "$buildPlist" | /usr/bin/perl -pe 's/(\d+\.)(\d+)/$1.($2+1)/eg'` | |
echo $bundleShortVersion; | |
/usr/libexec/PListBuddy -c "Set :CFBundleShortVersionString $bundleShortVersion" "$buildPlist" | |
else | |
echo "Bumping bundle version number..." | |
buildPlist=${INFOPLIST_FILE} | |
echo "${INFOPLIST_FILE}" | |
bundleVersion=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$buildPlist" | /usr/bin/perl -pe 's/(\d+\.\d+\.)(\d+)/$1.($2+1)/eg'` | |
echo $bundleVersion; | |
/usr/libexec/PListBuddy -c "Set :CFBundleVersion $bundleVersion" "$buildPlist" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment