Created
October 12, 2012 22:57
-
-
Save RandyMcMillan/3882118 to your computer and use it in GitHub Desktop.
Use git tag as build (#) in iOS app
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
NSDictionary *appInfo = [[NSBundle mainBundle] infoDictionary]; | |
NSString *versionStr = [NSString stringWithFormat:@"build (%@)", | |
[appInfo objectForKey:@"GitTag"]]; | |
self.detailDescriptionLabel.text = versionStr; |
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
***In your build phase | |
infoplist="$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH" | |
gittag="$(cd "$SRCROOT" && git describe --always --abbrev=0)" | |
if [[ -n "$gittag" ]]; then | |
defaults write "${infoplist%.plist}" GitTag "$gittag" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uses the last tag as a build value