Skip to content

sergemoskalenko/MSVXcodeBuildNumberToCountGitCommits

Repository files navigation

MSVXcodeBuildNumberToCountGitCommits - Set the build number to the count of Git commits

Xcode: Set the build number to the count of Git commits http://camopu.rhorse.ru/MSVXcodeBuildNumberToCountGitCommits.html

Set the build number to the count of Git commits

# Set the build number to the count of Git commits
# https://github.com/sergemoskalenko/MSVXcodeBuildNumberToCountGitCommits

buildNumber=$(git rev-list --count --first-parent HEAD)
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${INFOPLIST_FILE}"

Synchronize build number and version on extensions and main application.

buildNumber=$(git rev-list --count --first-parent HEAD)
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "${INFOPLIST_FILE}"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${buildNumber}" "${PROJECT_DIR}/TodayExtension/Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${buildNumber}" "${PROJECT_DIR}/Watch/Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${buildNumber}" "${PROJECT_DIR}/Watch Extension/Info.plist"

buildVersion=$(/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" "${INFOPLIST_FILE}")
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${buildVersion}" "${PROJECT_DIR}/TodayExtension/Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${buildVersion}" "${PROJECT_DIR}/Watch/Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${buildVersion}" "${PROJECT_DIR}/Watch Extension/Info.plist"

Screen

Screen

Add new script to build phase and paste it.

About

Xcode: Set the build number to the count of Git commits

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages