Skip to content

Instantly share code, notes, and snippets.

@RyanMillerC
Last active June 13, 2019 13:26
Show Gist options
  • Save RyanMillerC/af9a496a8496dcd11efbad347a75fc90 to your computer and use it in GitHub Desktop.
Save RyanMillerC/af9a496a8496dcd11efbad347a75fc90 to your computer and use it in GitHub Desktop.
Build and deploy ExpoKit project to iPad
#!/bin/bash
#
# Build and deploy stand-alone production-optimized React Native project to device for testing
#
# WARNING: This can take a long time (~10 minutes) to complete
#
[[ -f .env ]] && source .env
if [[ -z ${XCODE_SCHEME} ]] ; then
echo "XCODE_SCHEME must be set in .env" && exit 1
fi
xcodebuild -workspace ios/${XCODE_SCHEME}.xcworkspace \
-scheme ${XCODE_SCHEME} \
-configuration AppStoreDistribution \
archive \
-archivePath ${PWD}/build
if [[ $? -ne 0 ]] ; then
echo "Archive not deployed"
echo "Please correct errors and retry" && exit 1
fi
app_bundle="${PWD}/build.xcarchive/Products/Applications/${XCODE_SCHEME}.app"
ios-deploy --bundle ${app_bundle}
#!/bin/bash
#
# Build and deploy React Native project to device for development
#
[[ -f .env ]] && source .env
if [[ -z ${XCODE_DESTINATION_NAME} ]] ; then
echo "XCODE_DESTINATION_NAME must be set to your device's name in .env" && exit 1
elif [[ -z ${XCODE_SCHEME} ]] ; then
echo "XCODE_SCHEME must be set in .env" && exit 1
fi
xcodebuild -workspace ios/${XCODE_SCHEME}.xcworkspace \
-scheme ${XCODE_SCHEME} \
-destination "platform=iOS,name=${XCODE_DESTINATION_NAME}" \
-derivedDataPath ${PWD}/build
if [[ $? -ne 0 ]] ; then
echo "Build not deployed to ${XCODE_DESTINATION_NAME}"
echo "Please correct errors and retry" && exit 1
fi
app_bundle="${PWD}/build/Build/Products/Debug-iphoneos/${XCODE_SCHEME}.app"
ios-deploy --bundle ${app_bundle}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment