Created
May 11, 2012 02:27
-
-
Save seiji/2657122 to your computer and use it in GitHub Desktop.
jenkins-build-Unity-iPhone-TestFlight
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
UNITY_APP_PATH=/Applications/Unity3.4/Unity.app/Contents/MacOS/Unity | |
UNITY_PROJECT_PATH=$WORKSPACE/Unity | |
UNITY_EDITOR_LOG_PATH=~/Library/Logs/Unity/Editor.log | |
XCODE_PROJECT_PATH=$WORKSPACE/Unity-iPhone | |
KEYCHAIN_LOCATION=~/Library/Keychains/login.keychain | |
XCODE_PROJECT_CONFIG_PATH=$XCODE_PROJECT_PATH/Unity-iPhone.xcodeproj | |
### EDIT AREA START | |
UNITY_BATCH_EXECUTE_METHOD=XXXXX | |
IOS_PROVISIONING_FILE_PATH=XXXXX | |
IOS_P12_FILE_PATH=XXXXX | |
iOS_P12_PASSWORD=XXXXX | |
OSX_ADMIN_PASSWORD=XXXXX | |
CONFIGURATION=Debug # Debug, Release | |
IDENTITY=XXXXX | |
PRODUCT_NAME=XXXXX | |
API_TOKEN=XXXXX | |
TEAM_TOKEN=XXXXX | |
DISTRIBUTION_LISTS=XXXXX | |
### EDIT AREA END | |
PROFILE_UUID=`grep "UUID" ${IOS_PROVISIONING_FILE_PATH} -A 1 --binary-files=text 2>/dev/null |grep string|sed -e 's/^[[:blank:]]<string>//' -e 's/<\/string>//'` | |
$UNITY_APP_PATH -batchmode -quit -projectPath "${UNITY_PROJECT_PATH}" -executeMethod $UNITY_BATCH_EXECUTE_METHOD | |
if [ $? -eq 1 ]; then | |
cat $UNITY_EDITOR_LOG_PATH | |
exit 1 | |
fi | |
### xcodebuild | |
# unlock keychain | |
security unlock-keychain -p $OSX_ADMIN_PASSWORD "${KEYCHAIN_LOCATION}" | |
# import | |
security import "${IOS_P12_FILE_PATH}" -f pkcs12 -P "${iOS_P12_PASSWORD}" -k "${KEYCHAIN_LOCATION}" -T /usr/bin/codesign | |
cp $IOS_PROVISIONING_FILE_PATH ~/Library/MobileDevice/Provisioning\ Profiles/$PROFILE_UUID.mobileprovision | |
# .dSYM | |
BUILD_OPT_MAKE_DSYM="GCC_GENERATE_DEBUGGING_SYMBOLS=YES DEBUG_INFORMATION_FORMAT=dwarf-with-dsym DEPLOYMENT_POSTPROCESSING=YES STRIP_INSTALLED_PRODUCT=YES SEPARATE_STRIP=YES COPY_PHASE_STRIP=NO" | |
# clean (optional) | |
xcodebuild clean -configuration $CONFIGURATION -project "${XCODE_PROJECT_CONFIG_PATH}" | |
# build | |
xcodebuild \ | |
-project "${XCODE_PROJECT_CONFIG_PATH}" \ | |
-configuration "${CONFIGURATION}" \ | |
-target "Unity-iPhone" \ | |
CODE_SIGN_IDENTITY="${IDENTITY}" \ | |
OTHER_CODE_SIGN_FLAGS="--keychain ${KEYCHAIN_LOCATION}" \ | |
$BUILD_OPT_MAKE_DSYM | |
### create ipa | |
TARGET_APP_PATH=$XCODE_PROJECT_PATH/build/$PRODUCT_NAME.app | |
IPA_FILE_PATH=$XCODE_PROJECT_PATH/build/$PRODUCT_NAME-$BUILD_NUMBER.ipa | |
/usr/bin/xcrun \ | |
-sdk iphoneos \ | |
PackageApplication \ | |
-v "${TARGET_APP_PATH}" \ | |
-o "${IPA_FILE_PATH}" \ | |
--sign "${IDENTITY}" \ | |
--embed "${IOS_PROVISIONING_FILE_PATH}" | |
TARGET_DSYM=$PRODUCT_NAME.app.dSYM | |
DSYM_ZIP_PATH=$XCODE_PROJECT_PATH/build/$PRODUCT_NAME.app.dSYM-$BUILD_NUMBER.zip | |
cd $XCODE_PROJECT_PATH/build/ | |
zip -r $DSYM_ZIP_PATH $TARGET_DSYM | |
### post testflight | |
curl http://testflightapp.com/api/builds.json \ | |
-F file=@$IPA_FILE_PATH \ | |
-F dsym=@$DSYM_ZIP_PATH \ | |
-F api_token=$API_TOKEN \ | |
-F team_token=$TEAM_TOKEN \ | |
-F notes="`git log -5`" \ | |
-F notify=True \ | |
-F distribution_lists=$DISTRIBUTION_LISTS | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment