Skip to content

Commit 2b15d2f

Browse files
authored
Updates from testing (#1)
Updates from testing
1 parent ed0e527 commit 2b15d2f

File tree

5 files changed

+178
-40
lines changed

5 files changed

+178
-40
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Add Identifiers
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
identifiers:
7+
runs-on: macos-12
8+
steps:
9+
# Uncomment to manually select latest Xcode if needed
10+
#- name: Select Latest Xcode
11+
# run: "sudo xcode-select --switch /Applications/Xcode_13.0.app/Contents/Developer"
12+
13+
# Checks-out the repo
14+
- name: Checkout Repo
15+
uses: actions/checkout@v2
16+
17+
# Patch Fastlane Match to not print tables
18+
- name: Patch Match Tables
19+
run: find /usr/local/lib/ruby/gems -name table_printer.rb | xargs sed -i "" "/puts(Terminal::Table.new(params))/d"
20+
21+
# Create or update identifiers for app
22+
- name: Fastlane Provision
23+
run: fastlane identifiers
24+
env:
25+
TEAMID: ${{ secrets.TEAMID }}
26+
GH_PAT: ${{ secrets.GH_PAT }}
27+
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
28+
FASTLANE_KEY_ID: ${{ secrets.FASTLANE_KEY_ID }}
29+
FASTLANE_ISSUER_ID: ${{ secrets.FASTLANE_ISSUER_ID }}
30+
FASTLANE_KEY: ${{ secrets.FASTLANE_KEY }}

.github/workflows/create_certs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name: Generate Certificates
1+
name: Create Certificates
22
on:
33
workflow_dispatch:
44

55
jobs:
6-
build:
6+
certificates:
77
runs-on: macos-12
88
steps:
99
# Uncomment to manually select latest Xcode if needed
@@ -19,7 +19,7 @@ jobs:
1919
run: find /usr/local/lib/ruby/gems -name table_printer.rb | xargs sed -i "" "/puts(Terminal::Table.new(params))/d"
2020

2121
# Create or update certificates for app
22-
- name: Fastlane Create/Update Certificates
22+
- name: Create Certificates
2323
run: fastlane certs
2424
env:
2525
TEAMID: ${{ secrets.TEAMID }}

fastlane/Fastfile

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,23 @@ platform :ios do
6363
"com.#{TEAMID}.loopkit.Loop.SmallStatusWidget"
6464
]
6565
)
66+
67+
previous_build_number = latest_testflight_build_number(
68+
app_identifier: "com.#{TEAMID}.loopkit.Loop",
69+
api_key: api_key,
70+
)
71+
72+
current_build_number = previous_build_number + 1
73+
74+
increment_build_number(
75+
xcodeproj: "#{GITHUB_WORKSPACE}/Loop/Loop.xcodeproj",
76+
build_number: current_build_number
77+
)
6678

6779
mapping = Actions.lane_context[
6880
SharedValues::MATCH_PROVISIONING_PROFILE_MAPPING
6981
]
70-
82+
7183
update_code_signing_settings(
7284
path: "#{GITHUB_WORKSPACE}/Loop/Loop.xcodeproj",
7385
profile_name: mapping["com.#{TEAMID}.loopkit.Loop"],
@@ -80,7 +92,7 @@ platform :ios do
8092
code_sign_identity: "iPhone Distribution",
8193
targets: ["LoopCore", "LoopCore-watchOS", "LoopUI"]
8294
)
83-
95+
8496
update_code_signing_settings(
8597
path: "#{GITHUB_WORKSPACE}/Loop/Loop.xcodeproj",
8698
profile_name: mapping["com.#{TEAMID}.loopkit.Loop.statuswidget"],
@@ -140,8 +152,54 @@ platform :ios do
140152
skip_waiting_for_build_processing: true,
141153
)
142154
end
143-
144-
desc "Create/Update Certs"
155+
156+
desc "Provision Identifiers and Certificates"
157+
lane :identifiers do
158+
setup_ci if ENV['CI']
159+
ENV["MATCH_READONLY"] = false.to_s
160+
161+
app_store_connect_api_key(
162+
key_id: "#{FASTLANE_KEY_ID}",
163+
issuer_id: "#{FASTLANE_ISSUER_ID}",
164+
key_content: "#{FASTLANE_KEY}"
165+
)
166+
167+
def configure_bundle_id(name, identifier, capabilities)
168+
bundle_id = Spaceship::ConnectAPI::BundleId.find(identifier) || Spaceship::ConnectAPI::BundleId.create(name: name, identifier: identifier)
169+
capabilities.each { |capability|
170+
bundle_id.create_capability(capability)
171+
}
172+
end
173+
174+
configure_bundle_id("Loop", "com.#{TEAMID}.loopkit.Loop", [
175+
Spaceship::ConnectAPI::BundleIdCapability::Type::APP_GROUPS,
176+
Spaceship::ConnectAPI::BundleIdCapability::Type::HEALTHKIT,
177+
Spaceship::ConnectAPI::BundleIdCapability::Type::PUSH_NOTIFICATIONS,
178+
Spaceship::ConnectAPI::BundleIdCapability::Type::SIRIKIT
179+
])
180+
181+
configure_bundle_id("Loop Intent Extension", "com.#{TEAMID}.loopkit.Loop.Loop-Intent-Extension", [
182+
Spaceship::ConnectAPI::BundleIdCapability::Type::APP_GROUPS
183+
])
184+
185+
configure_bundle_id("Loop Status Extension", "com.#{TEAMID}.loopkit.Loop.statuswidget", [
186+
Spaceship::ConnectAPI::BundleIdCapability::Type::APP_GROUPS
187+
])
188+
189+
configure_bundle_id("WatchApp", "com.#{TEAMID}.loopkit.Loop.LoopWatch", [])
190+
191+
configure_bundle_id("WatchApp Extension", "com.#{TEAMID}.loopkit.Loop.LoopWatch.watchkitextension", [
192+
Spaceship::ConnectAPI::BundleIdCapability::Type::HEALTHKIT,
193+
Spaceship::ConnectAPI::BundleIdCapability::Type::SIRIKIT
194+
])
195+
196+
configure_bundle_id("Small Status Widget", "com.#{TEAMID}.loopkit.Loop.SmallStatusWidget", [
197+
Spaceship::ConnectAPI::BundleIdCapability::Type::APP_GROUPS
198+
])
199+
200+
end
201+
202+
desc "Provision Certificates"
145203
lane :certs do
146204
setup_ci if ENV['CI']
147205
ENV["MATCH_READONLY"] = false.to_s

fastlane/Matchfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
GITHUB_REPOSITORY_OWNER ||= ENV["GITHUB_REPOSITORY_OWNER"]
23

34
git_url("https://github.com/#{GITHUB_REPOSITORY_OWNER}/Match-Secrets.git")

fastlane/testflight.md

Lines changed: 82 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,60 +2,109 @@
22

33
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.
44

5+
The setup steps are somewhat involved, but nearly all are one time steps. Subsequent builds are trivial.
6+
57
## Prerequisites.
68

79
You don't need much!
810

9-
* A github account. The free level comes with plenty of storage and free compute time to build loop, multiple times a week, if you wanted to.
10-
* A paid Apple Developer account. You may be able to use the free version, but that has not been tested.
11+
* A [github account](https://github.com/signup). The free level comes with plenty of storage and free compute time to build loop, multiple times a week, if you wanted to.
12+
* A paid [Apple Developer account](https://developer.apple.com). You may be able to use the free version, but that has not been tested.
13+
* Some time. Set aside a couple of hours to perform the setup.
1114

1215

13-
## Apple Developer Steps
16+
## Generate App Store Connect API Key
1417

1518
1. Sign in to the [Apple developer portal page](https://developer.apple.com/account/resources/certificates/list)
1619
1. Copy the team id from the upper right of the screen. Record this as your `TEAMID`
1720
1. Go to the [App Store Connect](https://appstoreconnect.apple.com/access/api) interface, click the "Keys" tab, and create a new key with "Admin" access. Give it a name like "FastLane API Key"
1821
1. Record the key id; this will be used for `FASTLANE_KEY_ID`
1922
1. Record the issuer id; this will be used for `FASTLANE_ISSUER_ID`
2023
1. Download the API key itself, and open it in a text editor. The contents of this file will be used for `FASTLANE_KEY`
21-
1. At the [Certificates, Identifiers & Profiles](https://developer.apple.com/account/resources/identifiers/bundleId/add/bundle) page, add a new app identifier.
22-
* Description: Loop
23-
* The Bundle ID will be explicit and in the form `com.TEAMID.loopkit.Loop`, where `TEAMID` is your the value you recorded above.
24-
* For capabilities, check "App Groups, "HealthKit", "SiriKit", and "Time Sensitive Notifications"
25-
* Then click "Continue", and "Register".
26-
1. Go to the [apps list](https://appstoreconnect.apple.com/apps) on App Store Connect and create a New App.
27-
* Select "iOS"
28-
* 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.
29-
* Select your primary language
30-
* Select the Bundle Id you created above.
31-
* SKU can be anything; e.g. "123"
32-
* Select "Full Access"
33-
* Click Create
34-
* You do not need to fill out the next form. That is for submitting to the app store.
35-
36-
## GitHub Configuration Steps
3724

25+
## Setup Github
3826
1. Create a new empty repository titled `Match-Secrets`
3927
1. Fork https://github.com/LoopKit/LoopWorkspace into your account.
40-
1. Create a [new personal access token](https://github.com/settings/tokens/new)
41-
* Enter a name for your token. Something like "FastLane Access Token".
42-
* 30 days is fine, or you can select longer if you'd like.
43-
* Select the `repo` permission scope.
44-
* Click "Generate token"
45-
* Copy the token and record it. It will be used below as `GH_PAT`
28+
1. Create a [new personal access token](https://github.com/settings/tokens/new):
29+
* Enter a name for your token. Something like "FastLane Access Token".
30+
* 30 days is fine, or you can select longer if you'd like.
31+
* Select the `repo` permission scope.
32+
* Click "Generate token"
33+
* Copy the token and record it. It will be used below as `GH_PAT`
4634
1. In the forked LoopWorkspace repo, go to Settings -> Secrets -> Actions
4735
1. 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:
48-
* `TEAMID`
49-
* `FASTLANE_KEY_ID`
50-
* `FASTLANE_ISSUER_ID`
51-
* `FASTLANE_KEY`
52-
* `GH_PAT`
53-
* `MATCH_PASSWORD` - just make up a password for this
36+
* `TEAMID`
37+
* `FASTLANE_KEY_ID`
38+
* `FASTLANE_ISSUER_ID`
39+
* `FASTLANE_KEY`
40+
* `GH_PAT`
41+
* `MATCH_PASSWORD` - just make up a password for this
42+
43+
## Add Identifiers for Loop App
44+
45+
1. Click on the "Actions" tab of your LoopWorkspace repository.
46+
1. Select "Add Identifiers"
47+
1. Click "Run Workflow", and tap the green button.
48+
1. Wait, and within a minute or two you should see a green checkmark indicating the workflow succeeded.
49+
50+
## Create App Group
51+
52+
1. Go to [Register an App Group](https://developer.apple.com/account/resources/identifiers/applicationGroup/add/) on the apple developer site.
53+
1. For Description, use "Loop App Group"
54+
1. For Identifier, enter "group.com.TEAMID.loopkit.LoopGroup", subsituting your team id for `TEAMID`
55+
1. Click "Continue" and then "Register"
56+
57+
## Add App Group to Bundle Identifiers
58+
59+
1. Go to [Certificates, Identifiers & Profiles](https://developer.apple.com/account/resources/identifiers/list) on the apple developer site.
60+
1. For each of the following identifiers:
61+
* Loop
62+
* Loop Intent Extension
63+
* Loop Status Extension
64+
* Small Status Widget
65+
1. Click on the identifier's name.
66+
1. On the "App Groups" capabilies, click on the "Configure" button.
67+
1. Select the "Loop App Group"
68+
1. Click "Continue".
69+
1. Click "Save".
70+
1. Click "Confirm".
71+
1. Remember to do this for each of the identifiers above.
72+
73+
## Add Time Sensitive Notifications to Loop App ID
74+
1. Go to [Certificates, Identifiers & Profiles](https://developer.apple.com/account/resources/identifiers/list) on the apple developer site.
75+
1. Click on the "Loop" identifier
76+
1. Scroll down to "Time Sensitive Notifications"
77+
1. Tap the check box to enable Time Sensitive Notifications.
78+
1. Click "Save".
79+
1. Click "Confirm".
80+
1. Remember to do this for each of the identifiers above.
81+
82+
## Create Loop App in App Store Connect
83+
84+
1. Go to the [apps list](https://appstoreconnect.apple.com/apps) on App Store Connect and click the blue "plus" icon to create a New App.
85+
* Select "iOS"
86+
* 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.
87+
* Select your primary language
88+
* Choose the bundle ID that matches `com.TEAMID.loopkit.Loop`, with TEAMID matching your team id.
89+
* SKU can be anything; e.g. "123"
90+
* Select "Full Access"
91+
* Click Create
92+
* You do not need to fill out the next form. That is for submitting to the app store.
93+
94+
## Create Building Certficates
95+
96+
1. Go back to the "Actions" tab of your LoopWorkspace repository in github.
97+
1. Select "Create Certificates"
98+
1. Click "Run Workflow", and tap the green button.
99+
1. Wait, and within a minute or two you should see a green checkmark indicating the workflow succeeded.
54100

55101
## Build Loop!
56102

57103
1. Click on the "Actions" tab of your LoopWorkspace repository.
58104
1. Select "Build Loop"
59105
1. Click "Run Workflow", select your branch, and tap the green button.
60-
1. Wait, and your app should eventually appear on [App Store Connect](https://appstoreconnect.apple.com/apps)
61-
1. For each phone/person you would like to support Loop on, send an invite to using the TestFlight
106+
1. You have some time now. Go enjoy a coffee. The build should take about 20-30 minutes.
107+
1. Your app should eventually appear on [App Store Connect](https://appstoreconnect.apple.com/apps)
108+
1. For each phone/person you would like to support Loop on
109+
* Add them in [Users and Access](https://appstoreconnect.apple.com/access/users) on App Store Connect
110+
* Add them to your TestFlight Internal Testing group.

0 commit comments

Comments
 (0)