Skip to content

Instantly share code, notes, and snippets.

@lludo
Last active December 15, 2015 13:29
Show Gist options
  • Save lludo/5267658 to your computer and use it in GitHub Desktop.
Save lludo/5267658 to your computer and use it in GitHub Desktop.
Build and Package iOS Application for Jenkins (Ready for Testflight upload)
#!/bin/bash
# Configuration
KEYCHAIN_PASSWORD = <Pa$$w0rd>
WORKSPACE_FILE_NAME = <PongMadness>
SCHEME_NAME = <PongMadness Beta>
APP_NAME = <PongMadness-Beta>
# Update library dependencies
echo Building Dependencies
pod install
# Build Xcode Project
echo Building Project
rm -rf "${WORKSPACE}/Build"
security unlock-keychain -p ${KEYCHAIN_PASSWORD}
xcodebuild ONLY_ACTIVE_ARCH=NO CONFIGURATION_BUILD_DIR="${WORKSPACE}/Build/Intermediates" -workspace "${WORKSPACE_FILE_NAME}.xcworkspace" -scheme ${SCHEME_NAME} clean build
# Check if build succeeded
if [ $? != 0 ]
then
exit 1
fi
# Change the build version for testflight
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${BUILD_NUMBER}" "${WORKSPACE}/Build/Intermediates/${APP_NAME}.app/Info.plist"
# Create the IPA
mkdir "${WORKSPACE}/Build/Products"
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${WORKSPACE}/Build/Intermediates/${APP_NAME}.app" -o "${WORKSPACE}/Build/Products/${APP_NAME}-${BUILD_NUMBER}.ipa"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment