-
-
Save getaclue00/bb1cbbfdd12bb1b4b41a890f0cc92ffe to your computer and use it in GitHub Desktop.
Auto Increment Build and Version Numbers
This file contains hidden or 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
| #Works with Xcode 9 (Confirmed) | |
| #1. Go to "Edit Schemes" | |
| #2. Go to "Build" | |
| #3. Go to "Pre-Actions" | |
| #4. Select YOUR app in "Provide Build Settings from:" | |
| #5. Paste Below Script in Box | |
| #6. Build Project | |
| #Build Number ++ | |
| buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$PRODUCT_SETTINGS_PATH") | |
| buildNumber=$(($buildNumber + 1)) | |
| /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$PRODUCT_SETTINGS_PATH" | |
| #Version Number ++ | |
| VERSIONNUM=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "$PRODUCT_SETTINGS_PATH") | |
| NEWSUBVERSION=`echo $VERSIONNUM | awk -F "." '{print $3}'` | |
| NEWSUBVERSION=$(($NEWSUBVERSION + 1)) | |
| NEWVERSIONSTRING=`echo $VERSIONNUM | awk -F "." '{print $1 "." $2 ".'$NEWSUBVERSION'" }'` | |
| /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $NEWVERSIONSTRING" "$PRODUCT_SETTINGS_PATH" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment