Created
March 10, 2013 02:08
-
-
Save matejkramny/5126777 to your computer and use it in GitHub Desktop.
Increments the build number
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/bash | |
buildPlist="${PROJECT_DIR}/${INFOPLIST_FILE}" | |
# Get the existing buildVersion and buildNumber values from the buildPlist | |
versionString=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${buildPlist}") | |
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${buildPlist}") | |
buildDate=$(date "+%Y%m%d.%H%M%S") | |
# Increment the buildNumber | |
buildNumber=$(($buildNumber + 1)) | |
# Set the version numbers in the buildPlist | |
/usr/libexec/PlistBuddy -c "Set :CFBuildDate $buildDate" "${buildPlist}" | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${buildPlist}" | |
/usr/libexec/PlistBuddy -c "Set :CFBundleLongVersionString $versionString.$buildDate" "${buildPlist}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment