Created
June 1, 2016 10:45
-
-
Save ethanliu/7b8ca0ef571bfbbd217014834497d421 to your computer and use it in GitHub Desktop.
Xcode Build Script - Use git HEAD counts for CFBundleVersion without dirty the repo
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
git=`sh /etc/profile; which git` | |
appBuild=`"$git" rev-list HEAD --count` | |
infoPath="${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" | |
#infoPath="${PROJECT_DIR}"/"${INFOPLIST_FILE}" | |
if [ $CONFIGURATION = "Debug" ]; then | |
branchName=`"$git" rev-parse --abbrev-ref HEAD` | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $appBuild-$branchName" "$infoPath" | |
else | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $appBuild" "$infoPath" | |
fi | |
echo "Updated ($appBuild) $infoPath" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment