Created
February 28, 2015 22:14
-
-
Save ddaws/ceb3f89ca941691f8457 to your computer and use it in GitHub Desktop.
Update plist CFBundleVersion
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
#!/bin/sh | |
PLIST_FILE_NAME="Info.plist" | |
plist="${SRCROOT}/${PROJECT}/${PLIST_FILE_NAME}" | |
dir="${SRCROOT}/.." | |
# Only increment the build number if source files have changed | |
if [ -n "$(find "$dir" \! -path "*xcuserdata*" \! -path "*.git" -newer "$plist")" ]; then | |
buildnum=$(/usr/libexec/Plistbuddy -c "Print CFBundleVersion" "$plist") | |
if [ -z "$buildnum" ]; then | |
echo "No build number in $plist" | |
exit 2 | |
fi | |
buildnum=$(expr $buildnum + 1) | |
/usr/libexec/Plistbuddy -c "Set CFBundleVersion $buildnum" "$plist" | |
echo "Incremented build number to $buildnum" | |
else | |
echo "Not incrementing build number as source files have not changed" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment