Skip to content

Instantly share code, notes, and snippets.

@hramos
Created January 11, 2011 04:25
Show Gist options
  • Save hramos/774017 to your computer and use it in GitHub Desktop.
Save hramos/774017 to your computer and use it in GitHub Desktop.
Build and Archive script from command line. Use with testflight deployment script, or upload .ipa to web server (use iOS Beta Builder to create initial manifest files)
MY_USERNAME="username"
CONFIGURATION_NAME="Ad Hoc" # Distribution, Ad Hoc...
PROJDIR="/path-to-your-xcode-project"
APPLICATION_NAME="myapplication"
PROJECT_NAME="${APPLICATION_NAME}" # .xcodeproj ommitted
TARGET_SDK="iphoneos4.2" # current sdk
PROJECT_BUILDDIR="/Users/${MY_USERNAME}/path-to-build-dir/${CONFIGURATION_NAME}-iphoneos"
TARGET_TEST_NAME="${APPLICATION_NAME}"
BUILD_HISTORY_DIR="${PROJDIR}/distribution/" # write ${APPLICATION_NAME}.IPA here
DEVELOPER_NAME="Your Name (Bundle Prefix If Applicable)" # mine was company name
PROVISONING_PROFILE="/Users/${MY_USERNAME}/Library/MobileDevice/Provisioning Profiles/#####################.mobileprovision"
# compile project
echo Building Project
cd "${PROJDIR}"
xcodebuild -target "${PROJECT_NAME}" -sdk "${TARGET_SDK}" -configuration "${CONFIGURATION_NAME}"
#Check if build succeeded
if [ $? != 0 ]
then
exit 1
fi
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${PROJECT_BUILDDIR}/${PROJECT_NAME}.app" -o "${BUILD_HISTORY_DIR}/${APPLICATION_NAME}.ipa" --sign "${DEVELOPER_NAME}" --embed "${PROVISONING_PROFILE}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment