Continuous Integration & Deployment - Xcode 6.1, OS X Server 4, Testflight, Cocoapods [closed]
Asked Answered
A

0

12

With the recent release of Apple software, I could not find any up-to-date solutions for continuous integration & deployment using the new Xcode 6.1, OS X Server 4, and TestFlight (Apple's alpha/beta distribution platform). After hours of frustration, I was able to get everything working smoothly. I share this in hopes that I might save some of you from having to do the same.

This post is an updated version of Matt Vlasach's blog post found here.

Anyway, here are the steps...

1. Create and Share New Scheme

  • Open project in Xcode
  • Navigate to the top bar and choose Product > Scheme > Manage Schemes
  • Create new scheme, and click the "shared" checkmark

2. Configure Scheme Archive Post-action

  • Navigate to the top bar and choose Product > Scheme > Manage Schemes
  • Select the new scheme and click edit
  • Expand the "Archive" dropdown, and select "Post-actions"
  • Click the '+' at the bottom to create a “New Run Shell Script” action
  • Copy this script and edit the 5 values enclosed in "<>" tags to match your environment

3. Install Distribution Identity and Provisioning Profiles onto OS X Server

NOTE: These steps should be done on the Mac running OS X Server

  • If you do not have a valid distribution certificate installed, create (or export) a distribution certificate to your keychain
  • The certificate will default to the "login" category in the keychain, simply drag the certificate to the "System" category (located on the sidebar of the Keychain Access app)
  • Copy desired provisioning profiles to /Library/Developer/XcodeServer/ProvisioningProfiles/
    • Note: You will need to change the folder permissions to access it
    • Reminder: Be sure that the provision profiles have been signed with the distribution certificate installed on your machine

4. Change Code Signing Resource Rules Path

NOTE: This step is a workaround for an Xcode problem that seems to have been reintroduced in Xcode 6.1

  • Open project in Xcode
  • Navigate to Build Settings
  • In the Code Signing section, add $(SDKROOT)/ResourceRules.plist to "Code Signing Resource Rules Path"

5. Commit Changes to Remote Repository

  • Commit and push changes to remote repository

6. Create and Configure Xcode Bot

NOTE: These steps should be done on the Mac running OS X Server. Also, if you use SSH to access your project's git repository, there are a multitude of resources that guide you through additional steps in order for your Xcode bot to be allowed access to your repo.

  • Clone project from remote repository (if needed) and open in Xcode
  • Navigate to the top bar and choose Product > Create bot...
  • Select the scheme you created
  • Enter credentials for accessing the project's repository (if needed)
  • Choose desired schedule frequency, actions, etc. and create bot

After you have finished these steps, you should see the bot run an integration, which should clone your project from the remote repository, build it, and upload it to TestFlight!

NOTE: If you are using CocoaPods, when creating the new scheme, make sure the target is set to the workspace. Also, since Xcode bots and CocoaPods still do not play well together, do not have any files related to CocoaPods in your .gitignore. There are solutions out there to prevent having to track all these files in your repository, but I have yet to find a reliable solution.

Appetitive answered 5/11, 2014 at 21:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.