Skip to content

Build Loop using Github Actions and Fastlane #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

budsterblue
Copy link
Contributor

This PR adds a few Github Actions workflows that allow for building Loop without access to a Mac and without the hassle of a virtual machine. I've been using this to build Loop for my brother for around half a year now, and it's worked well, so recently I decided to clean it up and add a few features to make it useable from start to finish without a Mac or VM. A rough step-by-step guide with requirements is provided below that should hopefully cover enough of the process to get Loop built and installed. If this PR is well-received, I will open another PR for Loop Follow that uses almost the exact same process, essentially just replacing instances of "Loop" with "Loop Follow".

Note that I have only tested this process on Linux (not Windows), so I am unsure whether the binaries for libimobiledevice and ideviceinstaller actually work. The Linux versions did the job for me, but if this PR were to be merged, iTunes on Windows should be able to replace them without issue. Everything else about the guide is platform-independent (or cross-platform with gpg).

Requirements (Windows):

Requirements (Arch Linux installation command): yay -S gnupg libimobiledevice ideviceinstaller

Repo Setup:

  1. Create a new empty private repository titled Match-Secrets
  2. Fork budsterblue/LoopWorkspace

In the forked repository, go to Settings -> Secrets -> Actions
For each of the following steps, click "New repository secret". The numbered step is the name, and the text description is how to get the value.

Github Actions Secrets Setup:

  1. TEAMID
    Go to this Apple developer portal page and copy-paste the random-looking value in the upper right corner.
  2. GH_PAT
    Generate a new personal access token from here with repo, admin:org, admin:public_key, admin:repo_hook, and user selected (the scope can probably be reduced, but this is what I used when testing). Then copy-paste the ghp_******* text.
  3. For steps 4, 5, and 6, go to this App Store Connect page, click the "Keys" tab, click the blue plus icon, and select "Admin" for access.
  4. FASTLANE_KEY_ID
    Click "Copy Key ID" after hovering over the key ID.
  5. FASTLANE_ISSUER_ID
    Click the "Copy" text near the "Issuer ID" text.
  6. FASTLANE_KEY
    Click "Download API Key", then open the downloaded file with notepad and copy-paste the contents of the file.
  7. GPG_PASSWORD
    Any strong password you can think of.
  8. MATCH_PASSWORD
    Again, any strong password (preferably different).

For the Add Device, Generate Certificates, and Build Loop sections, be in the "Actions" tab in your forked repository.

Add Device (run for each device you want to install Loop on, but have not before):

  1. Plug the Apple device (iPhone, iPod, etc.) into the computer.
  2. Install libimobiledevice if not already installed, then open a command prompt or terminal and run idevice_id -l
  3. Select "Add Device" then click "Run workflow", and use the output from the previous step for the "Device ID" field, and something following the format of John iPhone 13 for the "Device Name" field, then click "Run workflow" again and wait for the spinning yellow icon on the page to turn green.
    a. Alternatively, go to this Apple developer page and add it there (debating removing the Github Actions workflow for this one and just going to the developer page for this).

Generate Certificates:

  1. Select "Generate Certificates", then click "Run workflow", then click the prompt's "Run workflow" and wait for the yellow icon to turn green.

Build Loop:

  1. Select "Build Loop", then click "Run workflow", then click the prompt's "Run workflow" and wait for the yellow icon to turn green.
  2. Once the icon has turned green, indicating that it's done (takes about 20 minutes), click the "Build Loop" text to the right of the icon, then click on "Loop" under "Artifacts" and wait for the download to finish.

Install Loop

  1. Unzip Loop.zip from the Downloads folder so that Loop.ipa.gpg is also in the Downloads folder.
  2. Install Gpg4win if not already installed, then open Kleopatra.
  3. Click "Decrypt/Verify", then find and select Loop.ipa.gpg from your Downloads folder.
  4. Enter the value you set for GPG_PASSWORD, then click "Save All"
  5. Plug the Apple device (iPhone, iPod, etc.) into the computer if not already plugged in.
  6. Install ideviceinstaller if not already installed, then open a command prompt or terminal and run cd Downloads, then run ideviceinstaller -i Loop.ipa.
  7. Profit! (Loop should now appear on the device if all went well)

From now on, to re-build Loop, just pull the changes from LoopKit/LoopWorkspace into your fork and follow the Generate Certificates (if they've expired), Build Loop, and Install Loop sections again.

@budsterblue
Copy link
Contributor Author

Naively thought there wouldn't be any breaking changes between master and dev branches. Latest commit now works with dev branch. That led me down a rabbit hole into finding out I've been using old Xcode generated App IDs, and deleting them causes the build to fail. I think I've identified a solution, so I should have a fix sometime in the next day or so. Until then, this process only works if you've built Loop at least once before.

@ps2
Copy link
Contributor

ps2 commented Nov 28, 2022

This is interesting... I think an approach like this, that used CI (circleci, travis, etc) to build, sign, and upload testflight (using xcrun altool), could be very useful, and would bypass the need to use idevice_id or custom installers, so could be much simpler for end users, and work on any platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants