Last active
February 10, 2017 12:35
-
-
Save sysradium/5aa1ef46d9873fc27514153add787e44 to your computer and use it in GitHub Desktop.
XCode project versioning
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 | |
GITBRANCH=$(git branch | grep "\*" | awk '{print $2}') | |
PREFIX="XC" | |
if [ -z "${PROJECT_DIR}" ]; then | |
PROJECT_DIR=$(pwd) | |
fi | |
GIT_BRANCH=$(git branch | grep "\*" | awk '{print $2}') | |
BUILD_NUMBER=$(xcrun git rev-list ${GIT_BRANCH} | wc -l | tr -d ' ') | |
BUILD_HASH=$(xcrun git rev-parse --short --verify master | tr -d ' ') | |
echo "#define ${PREFIX}BUILD_NUMBER ${BUILD_NUMBER}" > "${PROJECT_DIR}/Version.h" | |
echo "#define ${PREFIX}BUILD_HASH @\"${BUILD_HASH}\"" >> "${PROJECT_DIR}/Version.h" | |
find "${PROJECT_DIR}" -iname "*.plist" -maxdepth 1 -exec touch {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment