Skip to content

Instantly share code, notes, and snippets.

@RandyMcMillan
Created October 12, 2012 22:57
Show Gist options
  • Save RandyMcMillan/3882118 to your computer and use it in GitHub Desktop.
Save RandyMcMillan/3882118 to your computer and use it in GitHub Desktop.
Use git tag as build (#) in iOS app
NSDictionary *appInfo = [[NSBundle mainBundle] infoDictionary];
NSString *versionStr = [NSString stringWithFormat:@"build (%@)",
[appInfo objectForKey:@"GitTag"]];
self.detailDescriptionLabel.text = versionStr;
***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
@RandyMcMillan
Copy link
Author

Uses the last tag as a build value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment