Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
### Build Configuration
WORKSPACE=****
PROJECT_WORKSPACE=****
BUILD_NUMBER=****
SCHEME=****
CONFIGURATION=****
PROVISIONING_NAME=****
IPA_FILE_NAME=****.ipa
iOS_SDK=****
PASS=****
echo "************** Get the ProvisioningProfile UUID ***************"
KEYCHAIN=${HOME}/Library/Keychains/login.keychain
security cms -D -k ${KEYCHAIN} -i ${PROVISIONING_NAME}.mobileprovision > mptext
plutil -extract 'UUID' xml1 mptext
MPNAME=`/usr/libexec/PlistBuddy -c "Print $UUID" mptext`
rm mptext
# Install ProvisioningProfile
cp ${PROVISIONING_NAME}.mobileprovision ${HOME}/Library/MobileDevice/Provisioning\ Profiles/${MPNAME}.mobileprovision
PROVISIONING_PATH=\"${HOME}/Library/MobileDevice/Provisioning\ Profiles/${MPNAME}.mobileprovision\"
echo $PROVISIONING_PATH
# NOTE: Copy your iPhone developer certificate from "login" keychain to "System" keychain.
# Unlock keychain
echo "************** Unlock keychain ****************"
/usr/bin/security default-keychain -d user -s ${KEYCHAIN}
/usr/bin/security unlock-keychain -p ${PASS} ${KEYCHAIN}
/usr/bin/security find-identity -p codesigning -v
# Build project
echo "************** Build project ****************"
BUILD_DIR=${WORKSPACE}/build
/usr/bin/xcodebuild -scheme ${SCHEME} -workspace ${WORKSPACE}/${PROJECT_WORKSPACE}.xcworkspace -sdk ${iOS_SDK} -configuration ${CONFIGURATION} clean build CODE_SIGN_IDENTITY="iPhone Developer" PROVISIONING_PROFILE=${MPNAME} CONFIGURATION_BUILD_DIR=${BUILD_DIR}
# Create ipa
echo "************** Create ipa file ****************"
IPA_FILE=${BUILD_DIR}/${IPA_FILE_NAME}
/usr/bin/xcrun -sdk iphoneos PackageApplication -v ${BUILD_DIR}/${SCHEME}.app -o ${IPA_FILE} --embed ${PROVISIONING_PATH}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment