Last active
December 17, 2015 16:59
-
-
Save dictav/5643106 to your computer and use it in GitHub Desktop.
auto increment CFBundleVersion in Xcode project
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
InfoPlist="${SRCROOT}/${PROJECT_NAME}/${PRODUCT_NAME}-Info.plist" | |
bn=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" ${InfoPlist}` | |
IFS='.' | |
arr=[] | |
arr=($bn) | |
last_num=$((${#arr[*]}-1)) | |
echo $last_num | |
arr[$last_num]=$((arr[$last_num]+1)) | |
bn="${arr[*]}" | |
IFS='' | |
`/usr/libexec/PlistBuddy -c "Set CFBundleVersion ${bn}" ${InfoPlist}` |
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
if test $CONFIGURATION != "TestFlight"; then | |
exit | |
fi | |
echo "Increment build number" | |
InfoPlist="${SRCROOT}/${PROJECT_NAME}/${PRODUCT_NAME}-Info.plist" | |
bn=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" ${InfoPlist}` | |
IFS_BACKUP=$IFS | |
IFS='.' | |
arr=[] | |
arr=($bn) | |
arr[0]=$((arr[0]+1)) | |
arr[1]=`date "+%Y%m%d"` | |
bn="${arr[*]}" | |
IFS=$IFS_BACKUP | |
`/usr/libexec/PlistBuddy -c "Set CFBundleVersion ${bn}" ${InfoPlist}` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment