Created
September 17, 2015 14:47
-
-
Save slangley/f09aaa11bba608478546 to your computer and use it in GitHub Desktop.
Add version info to an 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
#!/usr/bin/perl | |
use strict; | |
die "$0: Must be run from Xcode" unless $ENV{"BUILT_PRODUCTS_DIR"}; | |
my $INFO = "$ENV{BUILT_PRODUCTS_DIR}/$ENV{WRAPPER_NAME}/Info.plist"; | |
my $G_COMMIT = `git rev-parse --short HEAD`; | |
my $G_BRANCH = `git rev-parse --abbrev-ref HEAD`; | |
my $G_VERSION = `/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${INFO}"`; | |
my $G_BUILDNUM = `git rev-list HEAD --count`; | |
chomp($G_COMMIT); | |
chomp($G_BRANCH); | |
chomp($G_VERSION); | |
chomp($G_BUILDNUM); | |
my $REV = "$G_VERSION($G_BUILDNUM) $G_BRANCH $G_COMMIT"; | |
print "REV: ^$REV^"; | |
`/usr/libexec/PlistBuddy -c "Set :BuildDescription $REV" "$INFO"`; | |
`/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $G_BUILDNUM" "$INFO"`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment