Created
April 8, 2014 08:51
-
-
Save Numan1617/dff95e1332dd14cc87c3 to your computer and use it in GitHub Desktop.
iOS - Automatic Version Numbering
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
# Use last tag as the base for the version. E.g. tag initial commit as 0.0 | |
LAST_TAG_VERSION=`git describe --tags | cut -f1 -d"-"` | |
# Optional. Same as above but keeps the commit hash | |
#LAST_TAG_VERSION=`git describe --tags` | |
# Total number of commits in the repository | |
TOTAL_COMMITS=`git rev-list HEAD --count` | |
# Write the version numbers to the compiled product | |
defaults write "${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH%.*}" "CFBundleShortVersionString" "${LAST_TAG_VERSION#*v}.${TOTAL_COMMITS}" | |
defaults write "${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH%.*}" "CFBundleVersion" "${LAST_TAG_VERSION#*v}.${TOTAL_COMMITS}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment