diff --git a/.circleci/config.yml b/.circleci/config.yml index f8c8865673..2bbb6ab20b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,11 +9,8 @@ jobs: command: git submodule update --init --recursive --depth 1 - run: name: Build Loop - command: set -o pipefail && time xcodebuild -workspace Loop.xcworkspace -scheme 'Loop (Workspace)' -destination 'platform=iOS Simulator,name=iPhone 13,OS=15.5' build | xcpretty - - run: - name: Build Learn - command: set -o pipefail && time xcodebuild -workspace Loop.xcworkspace -scheme 'Learn (Workspace)' -destination 'platform=iOS Simulator,name=iPhone 13,OS=15.5' build | xcpretty + command: set -o pipefail && time xcodebuild -workspace LoopWorkspace.xcworkspace -scheme 'LoopWorkspace' -destination 'platform=iOS Simulator,name=iPhone 13,OS=15.5' build | xcpretty - run: name: Run Tests - command: set -o pipefail && time xcodebuild -workspace Loop.xcworkspace -scheme 'Loop (Workspace)' -destination 'platform=iOS Simulator,name=iPhone 13,OS=15.5' test | xcpretty + command: set -o pipefail && time xcodebuild -workspace LoopWorkspace.xcworkspace -scheme 'LoopWorkspace' -destination 'platform=iOS Simulator,name=iPhone 13,OS=15.5' test | xcpretty diff --git a/.github/workflows/add_identifiers.yml b/.github/workflows/add_identifiers.yml index e28cbd2cac..62a2b543f5 100644 --- a/.github/workflows/add_identifiers.yml +++ b/.github/workflows/add_identifiers.yml @@ -1,9 +1,15 @@ -name: Add Identifiers +name: 2. Add Identifiers +run-name: Add Identifiers on: workflow_dispatch: jobs: + secrets: + uses: ./.github/workflows/validate_secrets.yml + secrets: inherit + identifiers: + needs: secrets runs-on: macos-12 steps: # Uncomment to manually select latest Xcode if needed diff --git a/.github/workflows/build_loop.yml b/.github/workflows/build_loop.yml index 7cf9921471..26ee8c1ed1 100644 --- a/.github/workflows/build_loop.yml +++ b/.github/workflows/build_loop.yml @@ -1,9 +1,22 @@ -name: Build Loop +name: 4. Build Loop +run-name: Build Loop on: workflow_dispatch: + + ## Remove the "#" sign from the beginning of the line below to get automated builds on push (code changes in your repository) + #push: + + ## Remove the "#" sign from the beginning of the two lines below to get automated builds every two months + #schedule: + #- cron: '0 17 1 */2 *' # Runs at 17:00 UTC on the 1st in Jan, Mar, May, Jul, Sep and Nov. jobs: + secrets: + uses: ./.github/workflows/validate_secrets.yml + secrets: inherit + build: + needs: secrets runs-on: macos-12 steps: # Uncomment to manually select latest Xcode if needed diff --git a/.github/workflows/create_certs.yml b/.github/workflows/create_certs.yml index 95a224c82b..82961983c0 100644 --- a/.github/workflows/create_certs.yml +++ b/.github/workflows/create_certs.yml @@ -1,9 +1,15 @@ -name: Create Certificates +name: 3. Create Certificates +run-name: Create Certificates on: workflow_dispatch: jobs: + secrets: + uses: ./.github/workflows/validate_secrets.yml + secrets: inherit + certificates: + needs: secrets runs-on: macos-12 steps: # Uncomment to manually select latest Xcode if needed diff --git a/.github/workflows/validate_secrets.yml b/.github/workflows/validate_secrets.yml new file mode 100644 index 0000000000..70401888c6 --- /dev/null +++ b/.github/workflows/validate_secrets.yml @@ -0,0 +1,70 @@ +name: 1. Validate Secrets +run-name: Validate Secrets +on: [workflow_call, workflow_dispatch] + +jobs: + validate: + runs-on: macos-12 + steps: + # Checks-out the repo + - name: Checkout Repo + uses: actions/checkout@v3 + + # Validates the repo secrets + - name: Validate Secrets + run: | + # Validate Secrets + echo Validating Repository Secrets... + + # Validate TEAMID + if [ -z "$TEAMID" ]; then + failed=true + echo "::error::TEAMID secret is unset or empty. Set it and try again." + elif [ ${#TEAMID} -ne 10 ]; then + failed=true + echo "::error::TEAMID secret is set but has wrong length. Verify that it is set correctly and try again." + fi + + # Validate GH_PAT + if [ -z "$GH_PAT" ]; then + failed=true + echo "::error::GH_PAT secret is unset or empty. Set it and try again." + elif [ "$(gh api -H "Accept: application/vnd.github+json" /repos/${{ github.repository_owner }}/Match-Secrets | jq --raw-output '.permissions.push')" != "true" ]; then + failed=true + echo "::error::GH_PAT secret is set but invalid or lacking appropriate privileges on the ${{ github.repository_owner }}/Match-Secrets repository. Verify that it is set correctly and try again." + fi + + # Validate FASTLANE_ISSUER_ID, FASTLANE_KEY_ID, and FASTLANE_KEY + if [ -z "$FASTLANE_ISSUER_ID" ] || [ -z "$FASTLANE_KEY_ID" ] || [ -z "$FASTLANE_KEY" ]; then + failed=true + [ -z "$FASTLANE_ISSUER_ID" ] && echo "::error::The FASTLANE_ISSUER_ID secret is unset or empty. Set it and try again." + [ -z "$FASTLANE_KEY_ID" ] && echo "::error::The FASTLANE_KEY_ID secret is unset or empty. Set it and try again." + [ -z "$FASTLANE_KEY" ] && echo "::error::The FASTLANE_KEY secret is unset or empty. Set it and try again." + elif ! echo "$FASTLANE_KEY" | openssl pkcs8 -nocrypt >/dev/null; then + failed=true + echo "::error::The FASTLANE_KEY secret is set but invalid. Verify that it is set correctly and try again." + elif ! fastlane validate_secrets; then + failed=true + echo "::error::Unable to create a valid authorization token for the App Store Connect API.\ + Verify that the FASTLANE_ISSUER_ID, FASTLANE_KEY_ID, and FASTLANE_KEY secrets are set correctly and try again." + fi + + # Validate MATCH_PASSWORD + if [ -z "$MATCH_PASSWORD" ]; then + failed=true + echo "::error::The MATCH_PASSWORD secret is unset or empty. Set it and try again." + fi + + # Exit unsuccessfully if secret validation failed. + if [ $failed ]; then + exit 2 + fi + shell: bash + env: + TEAMID: ${{ secrets.TEAMID }} + GH_PAT: ${{ secrets.GH_PAT }} + FASTLANE_ISSUER_ID: ${{ secrets.FASTLANE_ISSUER_ID }} + FASTLANE_KEY_ID: ${{ secrets.FASTLANE_KEY_ID }} + FASTLANE_KEY: ${{ secrets.FASTLANE_KEY }} + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} + GH_TOKEN: ${{ secrets.GH_PAT }} diff --git a/.gitmodules b/.gitmodules index 93a3716d01..fd3101427e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -46,3 +46,9 @@ [submodule "G7SensorKit"] path = G7SensorKit url = https://github.com/LoopKit/G7SensorKit.git +[submodule "TidepoolService"] + path = TidepoolService + url = https://github.com/LoopKit/TidepoolService.git +[submodule "TidepoolKit"] + path = TidepoolKit + url = https://github.com/LoopKit/TidepoolKit.git diff --git a/AmplitudeService b/AmplitudeService index dd6624d35a..2ee3b253fd 160000 --- a/AmplitudeService +++ b/AmplitudeService @@ -1 +1 @@ -Subproject commit dd6624d35a915dc57c627df2cfc062ceaa209ee5 +Subproject commit 2ee3b253fd240475010f45281e21439ca0f695a6 diff --git a/CGMBLEKit b/CGMBLEKit index a371955c44..99dc051aff 160000 --- a/CGMBLEKit +++ b/CGMBLEKit @@ -1 +1 @@ -Subproject commit a371955c44962bdb8f842607c0c0e49a1f4ada6a +Subproject commit 99dc051affd5cec5e31471491b5857d51699d740 diff --git a/G7SensorKit b/G7SensorKit index 27c84efbdf..0ee0d3ba53 160000 --- a/G7SensorKit +++ b/G7SensorKit @@ -1 +1 @@ -Subproject commit 27c84efbdf3a4aa99431e89ef96fdcfa6ad99e53 +Subproject commit 0ee0d3ba53db9322f53fba27d8d17147fa800131 diff --git a/LogglyService b/LogglyService index 6e4133d4c3..11c9875e62 160000 --- a/LogglyService +++ b/LogglyService @@ -1 +1 @@ -Subproject commit 6e4133d4c3fa63fd3615153330ab5ecaff3cf3b1 +Subproject commit 11c9875e6298253e974d3caf0fd5d53b1efad024 diff --git a/Loop b/Loop index 743b8d73c4..a1fb919703 160000 --- a/Loop +++ b/Loop @@ -1 +1 @@ -Subproject commit 743b8d73c4e8c7c74ce0aa22ce767ae8178a4c64 +Subproject commit a1fb919703987bf5daad390f589fec3481953c33 diff --git a/Loop.xcworkspace/xcshareddata/xcschemes/Learn (Workspace).xcscheme b/Loop.xcworkspace/xcshareddata/xcschemes/Learn (Workspace).xcscheme deleted file mode 100644 index 8b80d86f0d..0000000000 --- a/Loop.xcworkspace/xcshareddata/xcschemes/Learn (Workspace).xcscheme +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/LoopConfigOverride.xcconfig b/LoopConfigOverride.xcconfig index c6bee74430..3ffab2cb93 100644 --- a/LoopConfigOverride.xcconfig +++ b/LoopConfigOverride.xcconfig @@ -6,6 +6,9 @@ // Customize this to change the app name displayed //MAIN_APP_DISPLAY_NAME = Loop +// Customize this to change the URL to open Loop to something other than the display name +//URL_SCHEME_NAME = $(MAIN_APP_DISPLAY_NAME) + // Features SWIFT_ACTIVE_COMPILATION_CONDITIONS = $(inherited) SIMULATORS_ENABLED //DEBUG_FEATURES_ENABLED diff --git a/LoopKit b/LoopKit index 0d5929e677..6073eb1f4a 160000 --- a/LoopKit +++ b/LoopKit @@ -1 +1 @@ -Subproject commit 0d5929e677e8fa6526860ba9538f1317067f7802 +Subproject commit 6073eb1f4adaaeeb449589c21f251db2138b2c89 diff --git a/LoopOnboarding b/LoopOnboarding index 2b3a970453..23e40a2576 160000 --- a/LoopOnboarding +++ b/LoopOnboarding @@ -1 +1 @@ -Subproject commit 2b3a970453bfa7d0890df6dc802cab9b0820dc8d +Subproject commit 23e40a2576ca60bb378ecadaf0e481c019d22aec diff --git a/LoopSupport b/LoopSupport index 00b2cfdff1..a3e89c0f5e 160000 --- a/LoopSupport +++ b/LoopSupport @@ -1 +1 @@ -Subproject commit 00b2cfdff1c412d01ab6e6958c37ce54e35f8e22 +Subproject commit a3e89c0f5ed958f5ee76d655cb10a65de2d23a54 diff --git a/Loop.xcworkspace/contents.xcworkspacedata b/LoopWorkspace.xcworkspace/contents.xcworkspacedata similarity index 80% rename from Loop.xcworkspace/contents.xcworkspacedata rename to LoopWorkspace.xcworkspace/contents.xcworkspacedata index 7fb19613f6..2b1c12fc70 100644 --- a/Loop.xcworkspace/contents.xcworkspacedata +++ b/LoopWorkspace.xcworkspace/contents.xcworkspacedata @@ -1,6 +1,16 @@ + + + + + + @@ -31,6 +41,12 @@ + + + + diff --git a/Loop.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/LoopWorkspace.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from Loop.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to LoopWorkspace.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Loop.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/LoopWorkspace.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings similarity index 100% rename from Loop.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings rename to LoopWorkspace.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/Loop.xcworkspace/xcshareddata/swiftpm/Package.resolved b/LoopWorkspace.xcworkspace/xcshareddata/swiftpm/Package.resolved similarity index 86% rename from Loop.xcworkspace/xcshareddata/swiftpm/Package.resolved rename to LoopWorkspace.xcworkspace/xcshareddata/swiftpm/Package.resolved index ddb7dcb75f..8ef5acb7a9 100644 --- a/Loop.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/LoopWorkspace.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -36,12 +36,20 @@ "version" : "1.4.3" } }, + { + "identity" : "nightscoutkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/LoopKit/NightscoutKit", + "state" : { + "branch" : "main", + "revision" : "54c668c7154eca0ccd7b5714e1d206e488cd1bd9" + } + }, { "identity" : "onetimepassword", "kind" : "remoteSourceControl", "location" : "https://github.com/mattrubin/OneTimePassword", "state" : { - "branch" : "develop", "revision" : "8e4022f2852d77240d0a17482cbfe325354aac70" } }, diff --git a/Loop.xcworkspace/xcshareddata/xcschemes/Loop (Workspace).xcscheme b/LoopWorkspace.xcworkspace/xcshareddata/xcschemes/LoopWorkspace.xcscheme similarity index 95% rename from Loop.xcworkspace/xcshareddata/xcschemes/Loop (Workspace).xcscheme rename to LoopWorkspace.xcworkspace/xcshareddata/xcschemes/LoopWorkspace.xcscheme index 0f192961e3..88d49e15bd 100644 --- a/Loop.xcworkspace/xcshareddata/xcschemes/Loop (Workspace).xcscheme +++ b/LoopWorkspace.xcworkspace/xcshareddata/xcschemes/LoopWorkspace.xcscheme @@ -132,20 +132,6 @@ ReferencedContainer = "container:AmplitudeService/AmplitudeService.xcodeproj"> - - - - + + + + + + + + - - - - + + + + --recurse-submodules https://github.com/LoopKit/Loop Replace `` with the initial LoopWorkspace repository branch you wish to checkout. -## Open +### Open Change to the cloned directory and open the workspace in Xcode: @@ -21,15 +34,12 @@ cd LoopWorkspace xed . ``` -## Input your development team +### Input your development team You should be able to build to a simulator without changing anything. But if you wish to build to a real device, you'll need a developer account, and you'll need to tell Xcode about your team id, which you can find at https://developer.apple.com/. Select the LoopConfigOverride file in Xcode's project navigator, uncomment the `LOOP_DEVELOPMENT_TEAM`, and replace the existing team id with your own id. -## Build - -Select the "Loop (Workspace)" scheme (not the "Loop" scheme) and Build, Run, or Test. - -Image showing how to select the Loop (Workspace) scheme in Xcode +### Build +Select the "LoopWorkspace" scheme (not the "Loop" scheme) and Build, Run, or Test. diff --git a/Scripts/export_localizations.sh b/Scripts/export_localizations.sh new file mode 100755 index 0000000000..e02bace964 --- /dev/null +++ b/Scripts/export_localizations.sh @@ -0,0 +1,30 @@ +#!/bin/zsh + +set -e +set -u + +: "$LOKALISE_TOKEN" + +LANGUAGES=(ar es ru en zh-Hans nl fr de it nb pl ru es ja pt-BR vi da sv fi ro tr he sk) + +argstring="${LANGUAGES[@]/#/-exportLanguage }" +IFS=" "; args=( $=argstring ) + +xcodebuild -exportLocalizations -localizationPath xclocs $args + +mkdir -p xliff +find xclocs -name '*.xliff' -exec cp {} xliff \; + +cd xliff + +foreach lang in $LANGUAGES + + lang_iso=$(sed "s/zh-Hans/zh_Hans_CN/g; s/pt-BR/pt_BR/g" <<<"$lang") + + lokalise2 \ + --token $LOKALISE_TOKEN \ + --project-id 8069387863cdd837d11dd0.82955128 \ + file upload \ + --file ${lang}.xliff \ + --lang-iso ${lang_iso} +end diff --git a/Scripts/import_localizations.sh b/Scripts/import_localizations.sh new file mode 100755 index 0000000000..2f542711a3 --- /dev/null +++ b/Scripts/import_localizations.sh @@ -0,0 +1,56 @@ +#!/bin/zsh + +# Install the Lokalise command line tools from https://github.com/lokalise/lokalise-cli-2-go +# Generate an API Token (not an SDK Token!) following the instructions here: https://docs.lokalise.com/en/articles/1929556-api-tokens +# export LOKALISE_TOKEN="" +# export GH_TOKEN="" + +set -e +set -u + +: "$LOKALISE_TOKEN" +: "$GH_TOKEN" + +date=`date` + +# Fetch translations from Lokalise +lokalise2 \ + --token "$LOKALISE_TOKEN" \ + --project-id "8069387863cdd837d11dd0.82955128" \ + file download \ + --format xliff \ + --bundle-structure "%LANG_ISO%.%FORMAT%" \ + --original-filenames=false \ + --export-empty-as skip \ + --replace-breaks=false \ + --unzip-to ./xliff + + +# Build Loop +set -o pipefail && time xcodebuild -workspace Loop.xcworkspace -scheme 'Loop (Workspace)' build | xcpretty + + +# Apply translations +foreach file in xliff/*.xliff + xcodebuild -workspace Loop.xcworkspace -scheme "Loop (Workspace)" -importLocalizations -localizationPath $file +end + + +# Generate branches, commit and push. +projects=(LoopKit:AmplitudeService:dev LoopKit:CGMBLEKit:dev LoopKit:G7SensorKit:main LoopKit:LogglyService:dev LoopKit:Loop:dev LoopKit:LoopKit:dev LoopKit:LoopOnboarding:dev LoopKit:LoopSupport:dev LoopKit:NightscoutAPIClient:master ps2:NightscoutService:dev LoopKit:OmniBLE:dev LoopKit:TidepoolKit:dev LoopKit:TidepoolService:dev LoopKit:dexcom-share-client-swift:dev ps2:rileylink_ios:dev) +for project in ${projects}; do + echo "Working on $project" + IFS=":" read user dir branch <<< "$project" + echo "parts = $user $dir $branch" + cd $dir + set +e + git checkout -b translations + git add . + git commit -am "Updated translations from Lokalise on ${date}" + git push -f + pr=$(gh pr create -B $branch -R $user/$dir --fill 2>&1 | grep http) + echo "PR = $pr" + open $pr + cd .. +done + diff --git a/TidepoolKit b/TidepoolKit new file mode 160000 index 0000000000..5ec8e04e1b --- /dev/null +++ b/TidepoolKit @@ -0,0 +1 @@ +Subproject commit 5ec8e04e1b8e8c14bf7237a96d86d87863b61f6d diff --git a/TidepoolService b/TidepoolService new file mode 160000 index 0000000000..f31f515347 --- /dev/null +++ b/TidepoolService @@ -0,0 +1 @@ +Subproject commit f31f5153479839533e40a5e3fc17bab87ba6f4f1 diff --git a/dexcom-share-client-swift b/dexcom-share-client-swift index 1f07ca019e..7a0e3e92ed 160000 --- a/dexcom-share-client-swift +++ b/dexcom-share-client-swift @@ -1 +1 @@ -Subproject commit 1f07ca019ebb436f5d06ebe4154019501d93c1fb +Subproject commit 7a0e3e92ed2485f6bf7eda97421a442484e056cd diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 61542919a0..44f1573372 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -130,7 +130,7 @@ platform :ios do gym( export_method: "app-store", - scheme: "Loop (Workspace)", + scheme: "LoopWorkspace", output_name: "Loop.ipa", configuration: "Release", destination: 'generic/platform=iOS', @@ -231,6 +231,24 @@ platform :ios do ) end + desc "Validate Secrets" + lane :validate_secrets do + setup_ci if ENV['CI'] + ENV["MATCH_READONLY"] = true.to_s + + app_store_connect_api_key( + key_id: "#{FASTLANE_KEY_ID}", + issuer_id: "#{FASTLANE_ISSUER_ID}", + key_content: "#{FASTLANE_KEY}" + ) + + def find_bundle_id(identifier) + bundle_id = Spaceship::ConnectAPI::BundleId.find(identifier) + end + + find_bundle_id("com.#{TEAMID}.loopkit.Loop") + end + desc "Nuke Certs" lane :nuke_certs do setup_ci if ENV['CI'] diff --git a/fastlane/testflight.md b/fastlane/testflight.md index 7bb08ebdd0..aa0c6ec1bb 100644 --- a/fastlane/testflight.md +++ b/fastlane/testflight.md @@ -1,53 +1,104 @@ -# Using Github Actions + FastLane to deploy to TestFlight +# 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. +These instructions allow you to build Loop without having access to a Mac. -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. +* You can install Loop on phones via TestFlight that are not connected to your computer +* You can send builds and updates to those you care for +* You can install Loop on your phone using only the TestFlight app if a phone was lost or the app is accidentally deleted +* You do not need to worry about specific Xcode/Mac versions for a given iOS + +The setup steps are somewhat involved, but nearly all are one time steps. Subsequent builds are trivial. 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. The 90-day update is a TestFlight requirement, which can be automated. + +There are more detailed instructions in LoopDocs for using GitHub for Browser Builds of Loop, including troubleshooting and build errors. Please refer to: + +* [LoopDocs: GitHub Overview](https://loopkit.github.io/loopdocs/gh-actions/gh-overview/) +* [LoopDocs: GitHub Errors](https://loopkit.github.io/loopdocs/gh-actions/gh-errors/) + +Note that installing with TestFlight, (in the US), requires the Apple ID account holder to be 13 years or older. For younger Loopers, an adult must log into Media & Purchase on the child's phone to install Loop. More details on this can be found in [LoopDocs](https://loopkit.github.io/loopdocs/gh-actions/gh-deploy/#install-testflight-loop-for-child). ## Prerequisites -* 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 day, if you wanted to. -* A paid [Apple Developer account](https://developer.apple.com). You may be able to use the free version, but that has not been tested. +* 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 day, if you wanted to. +* A paid [Apple Developer account](https://developer.apple.com). * Some time. Set aside a couple of hours to perform the setup. +## Save 6 Secrets + +You require 6 Secrets (alphanumeric items) to use the GitHub build method and if you use the GitHub method to build more than Loop, e.g., Loop Follow or LoopCaregiver, you will use the same 6 Secrets for each app you build with this method. Each secret is indentified below by `ALL_CAPITAL_LETTER_NAMES`. + +* Four Secrets are from your Apple Account +* Two Secrets are from your GitHub account +* Be sure to save the 6 Secrets in a text file using a text editor + - Do **NOT** use a smart editor, which might auto-correct and change case, because these Secrets are case sensitive ## Generate App Store Connect API Key +This step is common for all GitHub Browser Builds; do this step only once. You will be saving 4 Secrets from your Apple Account in this step. + 1. Sign in to the [Apple developer portal page](https://developer.apple.com/account/resources/certificates/list). -1. Copy the team id from the upper right of the screen. Record this as your `TEAMID`. -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". -1. Record the key id; this will be used for `FASTLANE_KEY_ID`. +1. Copy the Team ID from the upper right of the screen. Record this as your `TEAMID`. +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 the name: "FastLane API Key". 1. Record the issuer id; this will be used for `FASTLANE_ISSUER_ID`. +1. Record the key id; this will be used for `FASTLANE_KEY_ID`. 1. 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 -1. Create a [new empty repository](https://github.com/new) titled `Match-Secrets`. It should be private. -1. Fork https://github.com/LoopKit/LoopWorkspace into your account. +## Create GitHub Personal Access Token + +Log into your GitHub account to create a personal access token; this is one of two GitHub secrets needed for your build. + 1. Create a [new personal access token](https://github.com/settings/tokens/new): - * Enter a name for your token. Something like "FastLane Access Token". - * 30 days is fine, or you can select longer if you'd like. + * Enter a name for your token, use "FastLane Access Token". + * Change the selection to 90 days. * Select the `repo` permission scope. * Click "Generate token". * Copy the token and record it. It will be used below as `GH_PAT`. -1. In the forked LoopWorkspace repo, go to Settings -> Secrets -> Actions. + +## Make up a Password + +This is the second one of two GitHub secrets needed for your build. + +The first time you build with the GitHub Browser Build method for any DIY app, you will make up a password and record it as `MATCH_PASSWORD`. Note, if you later lose `MATCH_PASSWORD`, you will need to delete and make a new Match-Secrets repository (next step). + +## Setup GitHub Match-Secrets Repository + +The creation of the Match-Secrets repository is a common step for all GitHub Browser Builds; do this step only once. You must be logged into your GitHub account. + +1. Create a [new empty repository](https://github.com/new) titled `Match-Secrets`. It should be private. + +Once created, you will not take any direct actions with this repository; it needs to be there for the GitHub to use as you progress through the steps. + +## Setup GitHub LoopWorkspace Repository + +1. Fork https://github.com/LoopKit/LoopWorkspace into your account. +1. In the forked LoopWorkspace repo, go to Settings -> Secrets and variables -> Actions. 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: * `TEAMID` - * `FASTLANE_KEY_ID` * `FASTLANE_ISSUER_ID` + * `FASTLANE_KEY_ID` * `FASTLANE_KEY` * `GH_PAT` - * `MATCH_PASSWORD` - just make up a password for this + * `MATCH_PASSWORD` + +## Validate repository secrets + +This step validates most of your six Secrets and provides error messages if it detects an issue with one or more. + +1. Click on the "Actions" tab of your LoopWorkspace repository and enable workflows if needed +1. On the left side, select "1. Validate Secrets". +1. On the right side, click "Run Workflow", and tap the green `Run workflow` button. +1. Wait, and within a minute or two you should see a green checkmark indicating the workflow succeeded. +1. The workflow will check if the required secrets are added and that they are correctly formatted. If errors are detected, please check the run log for details. ## Add Identifiers for Loop App 1. Click on the "Actions" tab of your LoopWorkspace repository. -1. Select "Add Identifiers". -1. Click "Run Workflow", and tap the green button. +1. On the left side, select "2. Add Identifiers". +1. On the right side, click "Run Workflow", and tap the green `Run workflow` button. 1. 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](#create-loop-app-in-app-store-connect). +If you have already built Loop via Xcode using this Apple ID, you can skip on to [Add App Group to Bundle Identifiers](#add-app-group-to-bundle-identifiers). 1. Go to [Register an App Group](https://developer.apple.com/account/resources/identifiers/applicationGroup/add/) on the apple developer site. 1. For Description, use "Loop App Group". @@ -56,6 +107,10 @@ If you have already built Loop via Xcode using this Apple ID, you can skip on to ## Add App Group to Bundle Identifiers +Note 1 - If you previously built with Xcode, the `Names` listed below may be different, but the `Identifiers` will match. A table is provided below the steps to assist. The Add Identifier Action that you completed above generates 6 identifiers, but only 4 need to be modified as indicated in this step. + +Note 2 - Depending on your build history, you may find some of the Identifiers are already configured - and you are just verifying the status; but in other cases, you will need to configure the Identifiers. + 1. Go to [Certificates, Identifiers & Profiles](https://developer.apple.com/account/resources/identifiers/list) on the apple developer site. 1. For each of the following identifier names: * Loop @@ -70,6 +125,18 @@ If you have already built Loop via Xcode using this Apple ID, you can skip on to 1. Click "Confirm". 1. Remember to do this for each of the identifiers above. +#### Table with Name and Identifier for Loop 3 + +| NAME | IDENTIFIER | +|-------|------------| +| Loop | com.TEAMID.loopkit.Loop | +| Loop Intent Extension | com.TEAMID.loopkit.Loop.Loop-Intent-Extension | +| Loop Status Extension | com.TEAMID.loopkit.Loop.statuswidget | +| Small Status Widget | com.TEAMID.loopkit.Loop.SmallStatusWidget | +| WatchApp | com.TEAMID.loopkit.Loop.LoopWatch | +| WatchAppExtension | com.TEAMID.loopkit.Loop.LoopWatch.watchkitextension | + + ## Add Time Sensitive Notifications to Loop App ID 1. Go to [Certificates, Identifiers & Profiles](https://developer.apple.com/account/resources/identifiers/list) on the apple developer site. 1. Click on the "Loop" identifier @@ -80,7 +147,7 @@ If you have already built Loop via Xcode using this Apple ID, you can skip on to ## 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. +If you have created a Loop app in App Store Connect before, you can skip this section. 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. * Select "iOS". @@ -95,18 +162,22 @@ You do not need to fill out the next form. That is for submitting to the app sto ## Create Building Certficates -1. Go back to the "Actions" tab of your LoopWorkspace repository in github. -1. Select "Create Certificates". -1. Click "Run Workflow", and tap the green button. +1. Go back to the "Actions" tab of your LoopWorkspace repository in GitHub. +1. On the left side, select "3. Create Certificates". +1. On the right side, click "Run Workflow", and tap the green `Run workflow` button. 1. Wait, and within a minute or two you should see a green checkmark indicating the workflow succeeded. -## Build Loop! +## Build Loop 1. Click on the "Actions" tab of your LoopWorkspace repository. -1. Select "Build Loop". -1. Click "Run Workflow", select your branch, and tap the green button. +1. On the left side, select "4. Build Loop". +1. On the right side, click "Run Workflow", and tap the green `Run workflow` button. 1. You have some time now. Go enjoy a coffee. The build should take about 20-30 minutes. 1. Your app should eventually appear on [App Store Connect](https://appstoreconnect.apple.com/apps). 1. For each phone/person you would like to support Loop on: * Add them in [Users and Access](https://appstoreconnect.apple.com/access/users) on App Store Connect. * Add them to your TestFlight Internal Testing group. + +## TestFlight and Deployment Details + +Please refer to [LoopDocs: Set Up Users](https://loopkit.github.io/loopdocs/gh-actions/gh-first-time/#set-up-users-and-access-testflight) and [LoopDocs: Deploy](https://loopkit.github.io/loopdocs/gh-actions/gh-deploy/) diff --git a/rileylink_ios b/rileylink_ios index 482ef4fb97..8a68c41e2c 160000 --- a/rileylink_ios +++ b/rileylink_ios @@ -1 +1 @@ -Subproject commit 482ef4fb972e1d5456f66990434d1069e5cba223 +Subproject commit 8a68c41e2ce05e47e1a5707d0c4ad05309bd3861