Skip to content

Instantly share code, notes, and snippets.

@davedelong
Created November 22, 2018 18:12
Show Gist options
  • Save davedelong/6c56e186db172e5af5a387efeb578b3c to your computer and use it in GitHub Desktop.
Save davedelong/6c56e186db172e5af5a387efeb578b3c to your computer and use it in GitHub Desktop.
Auto-increment build numbers in release mode
# Automatically increment the CFBundleVersion in release builds
config=${CONFIGURATION}
if [ "${config}" = "Release" ]; then
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${PROJECT_DIR}/${INFOPLIST_FILE}"
else
echo "info: Skipping build number incrementation in ${config} mode"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment