Created
September 24, 2019 10:15
-
-
Save byeounghoon/c8c1f867c9e1b3b56e101b8fa5cbebed to your computer and use it in GitHub Desktop.
빌드버전 관리
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
cd $PROJECT_DIR | |
buildDay=$(/usr/libexec/PlistBuddy -c "Print buildDay" "$INFOPLIST_FILE") | |
buildCount=$(/usr/libexec/PlistBuddy -c "Print buildCount" "$INFOPLIST_FILE") | |
today=$(date +%Y%m%d%H%M) | |
if [ x$buildDay == x ]; then | |
buildDay=${today} | |
buildCount=1 | |
printf -v zeroPadBuildCount "%03d" $buildCount | |
buildNumber=${buildDay}${zeroPadBuildCount} | |
/usr/libexec/PlistBuddy -c "Add :buildDay string $buildDay" "$INFOPLIST_FILE" | |
/usr/libexec/PlistBuddy -c "Add :buildCount string $buildCount" "$INFOPLIST_FILE" | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE" | |
elif [ $buildDay != $today ]; then | |
buildDay=${today} | |
buildCount=1 | |
printf -v zeroPadBuildCount "%03d" $buildCount | |
buildNumber=${buildDay}${zeroPadBuildCount} | |
/usr/libexec/PlistBuddy -c "Set :buildDay $buildDay" "$INFOPLIST_FILE" | |
/usr/libexec/PlistBuddy -c "Set :buildCount $buildCount" "$INFOPLIST_FILE" | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE" | |
else | |
buildCount=$(($buildCount + 1)) | |
printf -v zeroPadBuildCount "%03d" $buildCount | |
buildNumber=${buildDay}${zeroPadBuildCount} | |
/usr/libexec/PlistBuddy -c "Set :buildDay $buildDay" "$INFOPLIST_FILE" | |
/usr/libexec/PlistBuddy -c "Set :buildCount $buildCount" "$INFOPLIST_FILE" | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE" | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment