Created
January 20, 2012 06:21
-
-
Save amrox/1645706 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
git=$(which git) | |
function parse_git_branch { | |
ref=$(${git} symbolic-ref HEAD 2> /dev/null) || return | |
echo ${ref#refs/heads/} | sed 's/\//_/' | |
} | |
prefix_file="InfoPlist_Prefix.h" | |
marketing_version=$(cat MARKETING_VERSION) | |
git_version=$(git rev-parse HEAD) | |
git_short_version=$(git rev-parse --short HEAD) | |
git_branch=$(parse_git_branch) | |
build_number=${BUILD_NUMBER:-0} # if $BUILD_NUMBER is set, use it. Set to 0 otherwise. | |
if [ -z ${VERSION} ]; then | |
VERSION=${git_short_version} | |
fi | |
rm -f $prefix_file | |
echo "#define MARKETING_VERSION ${marketing_version}" >> $prefix_file | |
echo "#define BUILD_NUMBER ${build_number}" >> $prefix_file | |
echo "#define GIT_VERSION ${git_version}" >> $prefix_file | |
echo "#define GIT_BRANCH ${git_branch}" >> $prefix_file | |
echo "#define VERSION ${VERSION}" >> $prefix_file |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>BuildNumber</key> | |
<string>BUILD_NUMBER</string> | |
<key>CFBundleShortVersionString</key> | |
<string>MARKETING_VERSION</string> | |
<key>CFBundleVersion</key> | |
<string>VERSION</string> | |
<key>GitBranch</key> | |
<string>GIT_BRANCH</string> | |
<key>GitVersion</key> | |
<string>GIT_VERSION</string> | |
.... | |
</dict> | |
</plist> |
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
#define MARKETING_VERSION 2.5.9 | |
#define BUILD_NUMBER 0 | |
#define GIT_VERSION ca1f23d466ad83252ab23b63431a8c66b265d508 | |
#define GIT_BRANCH develop | |
#define VERSION ca1f23d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment