Using Github Actions + FastLane to deploy to TestFlight
These instructions allow you to build Loop without having access to a Mac. They also allow you to easily install Loop on phones that are not connected to your computer. So you can send builds and updates to those you care for easily, or have an easy to access backup if you run Loop for yourself. You do not need to worry about correct Xcode/Mac versions either. An app built using this method can easily be deployed to newer versions of iOS, as soon as they are available.
The setup steps are somewhat involved, but nearly all are one time steps. Subsequent builds are trivial. Note that TestFlight requires apple id accounts 13 years or older. Your app must be updated once every 90 days, but it's a simple click to make a new build and can be done from anywhere.
Prerequisites
- A github account. The free level comes with plenty of storage and free compute time to build loop, multiple times a day, if you wanted to.
- A paid Apple Developer account. You may be able to use the free version, but that has not been tested.
- Some time. Set aside a couple of hours to perform the setup.
Generate App Store Connect API Key
- Sign in to the Apple developer portal page.
- Copy the team id from the upper right of the screen. Record this as your
TEAMID.
- Go to the App Store Connect interface, click the "Keys" tab, and create a new key with "Admin" access. Give it a name like "FastLane API Key".
- Record the key id; this will be used for
FASTLANE_KEY_ID.
- Record the issuer id; this will be used for
FASTLANE_ISSUER_ID.
- Download the API key itself, and open it in a text editor. The contents of this file will be used for
FASTLANE_KEY. Copy the full text, including the "-----BEGIN PRIVATE KEY-----" and "-----END PRIVATE KEY-----" lines.
Setup Github
- Create a new empty repository titled
Match-Secrets. It should be private.
- Fork https://github.com/LoopKit/LoopWorkspace into your account.
- Create a new personal access token:
- Enter a name for your token. Something like "FastLane Access Token".
- 30 days is fine, or you can select longer if you'd like.
- Select the
repo permission scope.
- Click "Generate token".
- Copy the token and record it. It will be used below as
GH_PAT.
- In the forked LoopWorkspace repo, go to Settings -> Secrets -> Actions.
- For each of the following secrets, tap on "New repository secret", then add the name of the secret, along with the value you recorded for it:
TEAMID
FASTLANE_KEY_ID
FASTLANE_ISSUER_ID
FASTLANE_KEY
GH_PAT
MATCH_PASSWORD - just make up a password for this
Add Identifiers for Loop App
- Click on the "Actions" tab of your LoopWorkspace repository.
- Select "Add Identifiers".
- Click "Run Workflow", and tap the green button.
- Wait, and within a minute or two you should see a green checkmark indicating the workflow succeeded.
Create App Group
If you have already built Loop via Xcode using this Apple ID, you can skip on to Create Loop App in App Store Connect.
- Go to Register an App Group on the apple developer site.
- For Description, use "Loop App Group".
- For Identifier, enter "group.com.TEAMID.loopkit.LoopGroup", subsituting your team id for
TEAMID.
- Click "Continue" and then "Register".
Add App Group to Bundle Identifiers
- Go to Certificates, Identifiers & Profiles on the apple developer site.
- For each of the following identifier names:
- Loop
- Loop Intent Extension
- Loop Status Extension
- Small Status Widget
- Click on the identifier's name.
- On the "App Groups" capabilies, click on the "Configure" button.
- Select the "Loop App Group"
- Click "Continue".
- Click "Save".
- Click "Confirm".
- Remember to do this for each of the identifiers above.
Add Time Sensitive Notifications to Loop App ID
- Go to Certificates, Identifiers & Profiles on the apple developer site.
- Click on the "Loop" identifier
- Scroll down to "Time Sensitive Notifications"
- Tap the check box to enable Time Sensitive Notifications.
- Click "Save".
- Click "Confirm".
Create Loop App in App Store Connect
If you have created a Loop app in App Store Connect before, you can skip this section as well.
- Go to the apps list on App Store Connect and click the blue "plus" icon to create a New App.
- Select "iOS".
- Select a name: this will have to be unique, so you may have to try a few different names here, but it will not be the name you see on your phone, so it's not that important.
- Select your primary language.
- Choose the bundle ID that matches
com.TEAMID.loopkit.Loop, with TEAMID matching your team id.
- SKU can be anything; e.g. "123".
- Select "Full Access".
- Click Create
You do not need to fill out the next form. That is for submitting to the app store.
Create Building Certficates
- Go back to the "Actions" tab of your LoopWorkspace repository in github.
- Select "Create Certificates".
- Click "Run Workflow", and tap the green button.
- Wait, and within a minute or two you should see a green checkmark indicating the workflow succeeded.
Build Loop!
- Click on the "Actions" tab of your LoopWorkspace repository.
- Select "Build Loop".
- Click "Run Workflow", select your branch, and tap the green button.
- You have some time now. Go enjoy a coffee. The build should take about 20-30 minutes.
- Your app should eventually appear on App Store Connect.
- For each phone/person you would like to support Loop on:
- Add them in Users and Access on App Store Connect.
- Add them to your TestFlight Internal Testing group.