Skip to content

Instantly share code, notes, and snippets.

@kukat
Created August 29, 2013 09:45
Show Gist options
  • Select an option

  • Save kukat/6376160 to your computer and use it in GitHub Desktop.

Select an option

Save kukat/6376160 to your computer and use it in GitHub Desktop.
xcode command line build & archive .ipa
# Clean & Build .app
/usr/bin/xcodebuild -scheme PROJECT -workspace PROJECT.xcworkspace -configuration Release clean build CONFIGURATION_BUILD_DIR=${WORKSPACE}/build
# Sign & Pack .ipa
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${WORKSPACE}/build/${APPLICATION_NAME}.app" -o "${WORKSPACE}/build/${APPLICATION_NAME}.ipa" --sign "${DEVELOPER_NAME}" --embed "${PROVISONING_PROFILE}"
@kukat
Copy link
Author

kukat commented Sep 5, 2013

APPLICATION_NAME="Coffee Bean"

Clean & Build .app

/usr/bin/xcodebuild -scheme CBTL -workspace CBTL.xcworkspace -configuration Release clean build CONFIGURATION_BUILD_DIR=${WORKSPACE}/build

Sign & Pack .ipa

/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${WORKSPACE}/build/${APPLICATION_NAME}.app" -o "${WORKSPACE}/build/${APPLICATION_NAME}.ipa" --sign "iPhone Distribution: The Coffee Bean & Tea Leaf (SINGAPORE) PTE LTD" --embed "${HOME}/Downloads/CBTL_ADHOC.mobileprovision"

APP_PATH="${WORKSPACE}/build/${APPLICATION_NAME}.app"
IPA_PATH="${WORKSPACE}/build/${APPLICATION_NAME}.ipa"

Get the version from the Info.plist file

VERSION=defaults read "${APP_PATH}/Info" CFBundleShortVersionString
BUILD=defaults read "${APP_PATH}/Info" CFBundleVersion
BUNDLE_ID=defaults read "${APP_PATH}/Info" CFBundleIdentifier
BUNDLE_NAME_ESCAPED=php -r "print rawurlencode('${APPLICATION_NAME}');"
WEB_PATH=~/workspace/web
WWW_PATH=${WEB_PATH}/${BUNDLE_ID}/${BUILD_ID}
BUNDLE_VERSION="${VERSION} (Build ${BUILD})"
PLIST_URL="http://192.168.1.11/apps/${BUNDLE_ID}/${BUILD_ID}/manifest.plist"
IPA_URL="http://192.168.1.11/apps/${BUNDLE_ID}/${BUILD_ID}/${BUNDLE_NAME_ESCAPED}.ipa"

Move ipa to www folder

mkdir -p ${WWW_PATH}
cp ${IPA_PATH} ${WWW_PATH}

Create plist

cat ${WEB_PATH}/template.plist | sed -e "s/APP_NAME/${APPLICATION_NAME}/" -e "s/IPA_URL/${IPA_URL}/" -e "s/BUILD_ID/${BUILD_ID}/" -e "s/BUNDLE_ID/${BUNDLE_ID}/" -e "s/BUNDLE_VERSION/${BUNDLE_VERSION}/" > ${WWW_PATH}/manifest.plist

Create html

cat ${WEB_PATH}/template.html | sed -e "s/APP_NAME/${APPLICATION_NAME}/" -e "s/BUILD_ID/${BUILD_ID}/" -e "s/PLIST_URL/${PLIST_URL}/" -e "s/BUNDLE_VERSION/${BUNDLE_VERSION}/" > ${WWW_PATH}/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment