Created
January 2, 2015 23:13
-
-
Save barbosa/d0e9a75ceb2ba07c97b1 to your computer and use it in GitHub Desktop.
Shell script to archive and distribute IPA files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # source: http://www.raywenderlich.com/downloads/jenkins_shell_steps.txt | |
| ##################### | |
| # JENKINS step #1 | |
| # add to it's own execute shell section | |
| ##################### | |
| export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer | |
| xcodebuild -target GuildBrowserLogicTests \ | |
| -sdk iphonesimulator \ | |
| -configuration Debug \ | |
| TEST_AFTER_BUILD=YES \ | |
| clean build | /usr/local/bin/ocunit2junit.rb | |
| ##################### | |
| # JENKINS STEP #2 | |
| # add to it's own execute shell section | |
| ##################### | |
| # tests passed archive app | |
| export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer | |
| /usr/bin/xcrun xcodebuild -scheme GuildBrowser clean archive \ | |
| CODE_SIGN_IDENTITY="iPhone Distribution: Charles Fulton" | |
| echo "App Archived" | |
| ##################### | |
| # JENKINS STEP #3 | |
| # add to it's own execute shell section | |
| ##################### | |
| export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer | |
| # testflight stuff | |
| API_TOKEN=<insert yours> | |
| TEAM_TOKEN=<insert yours> | |
| # | |
| # Setup | |
| # | |
| # 1 | |
| PROJECT="GuildBrowser" | |
| SIGNING_IDENTITY="iPhone Distribution: Charles Fulton" | |
| PROVISIONING_PROFILE="${WORKSPACE}/Charles_Fulton_All_Ad_Hoc.mobileprovision" | |
| # 2 | |
| # this is the latest archive from previous build step | |
| ARCHIVE="$(ls -dt ~/Library/Developer/Xcode/Archives/*/${PROJECT}*.xcarchive|head -1)" | |
| # 3 | |
| IPA_DIR="${WORKSPACE}" | |
| DSYM="${ARCHIVE}/dSYMs/${PROJECT}.app.dSYM" | |
| APP="${ARCHIVE}/Products/Applications/${PROJECT}.app" | |
| # | |
| # PackageApplication | |
| # | |
| # package up the latest archived build | |
| /bin/rm -f "${IPA_DIR}/${PROJECT}.ipa" | |
| # 4 | |
| /usr/bin/xcrun -sdk iphoneos PackageApplication \ | |
| -o "${IPA_DIR}/${PROJECT}.ipa" \ | |
| -verbose "${APP}" \ | |
| -sign "${SIGNING_IDENTITY}" \ | |
| --embed "${PROVISIONING_PROFILE}" | |
| # zip and ship | |
| /bin/rm -f "${IPA_DIR}/${PROJECT}.dSYM.zip" | |
| # 5 | |
| /usr/bin/zip -r "${IPA_DIR}/${PROJECT}.dSYM.zip" "${DSYM}" | |
| # | |
| # Send to test flight | |
| # | |
| /usr/bin/curl "http://testflightapp.com/api/builds.json" \ | |
| -F file=@"${IPA_DIR}/${PROJECT}.ipa" \ | |
| -F dsym=@"${IPA_DIR}/${PROJECT}.dSYM.zip" \ | |
| -F api_token="${API_TOKEN}" \ | |
| -F team_token="${TEAM_TOKEN}" \ | |
| -F notes="Build ${BUILD_NUMBER} uploaded automatically from Xcode. Tested by Chuck Norris" \ | |
| -F notify=True \ | |
| -F distribution_lists='all' | |
| echo "Successfully sent to TestFlight" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment