r/FlutterDev • • Feb 27 '22

Article Step-by-step: Using GitHub Workflows to deploy iOS builds to TestFlight

http://jorgen.tjer.no/post/2022/02/26/flutter-github-workflows-and-testflight/
109 Upvotes

27 comments sorted by

10

u/jorgenpt Feb 27 '22

Would love any feedback folks have, and happy to try to answer questions as best I can. I spent a while beating my head against slow iteration times trying to figure this out for my own project, so I thought I'd write up a little blog post. :)

7

u/[deleted] Feb 27 '22

This is a really good tutorial, and I appreciate it.

From experience, setting up build / deployment pipelines for mobile is never a pretty / easy thing to get right as there is usually multiple technologies and tools to link together and the iteration process to test and make sure it’s all working is very slow. But it should be done as early as possible.

Tools like fastlane make some stuff easier through automation, but the entire process is still a pain in the ass. At my previous job, we were doing iOS builds and dealing with signing certificates and provisioning profile issues was so annoying and time wasting that we had just one engineer dedicated to dealing with the nonsense.

4

u/Xaxxus Feb 27 '22

This is a great resource even for standard iOS dev.

Fastlane is a bitch to get running the first time.

Even for existing projects when onboarding new devs.

1

u/limboo_o Feb 27 '22

Do you prefer another?!

4

u/Xaxxus Feb 27 '22 edited Feb 27 '22

An alternative to fastlane? There is none. At least not that I know of.

Xcode cloud is going to be my go to when it comes out. Won’t have to worry about certs or profiles ever again.

2

u/jorgenpt Feb 27 '22

I’m curious what the pricing is going to be for Xcode cloud. I’m very happy that I can stand something up on GitHub Actions for free to get started without commitment. :)

1

u/Xaxxus Feb 27 '22

Technically it’s only free if it’s open source.

Mac minutes on GitHub actions are very expensive for private repos.

1

u/jorgenpt Feb 27 '22

No, you get 2000 minutes every month for private repositories even for the free tier — though it’s unlimited for public repositories.

Yeah, the macOS builders are “expensive” (10 “minutes” per real minute), and my next post will be about optimizing build times for iOS in GitHub Workflows for that reason. :)

1

u/Xaxxus Feb 27 '22

Did they change this? It used to be 30 min for private repos if I recall correctly.

1

u/jorgenpt Feb 27 '22

Not sure, this is my first time using it for a private repo, I’ve only been using it for public ones prior. Pricing info here: https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions

1

u/Xaxxus Feb 27 '22

Ah. You could also setup your own GitHub runner if you have an old mac lying around. Takes 5 min to setup.

1

u/jorgenpt Feb 27 '22

Good point, sadly I’ve never owned a non-laptop Mac. 😆

I wonder if the self hosted runners isolate the runs as cleanly as the hosted ones 🤔

2

u/igoriuz Feb 27 '22

Great guide. You can use ruby 3 without any problems as well.

1

u/jorgenpt Feb 27 '22

Thanks, and good to know, I should update the article and my setup. :)

2

u/notrichardparker Feb 28 '22

Nice! I could have used this guide a few weeks ago. I found a few random articles and got my setup working pretty similar to yours.

Sort of related, do you just remember to update your build number each time you push to master? I’ve found a few times i would push all my changes and merge into master and then fastlane would eventually fail to upload because i attempted to upload the same version/build number twice in a row. Then I push a single commit to fix that 🙄

2

u/jorgenpt Feb 28 '22

My Fastfile automatically updates the build number to “latest on TestFlight + 1” before building, and the display name is based on the git tag (so a tag of “v0.20” will set the display name as “0.2.0”).

You can see https://github.com/jorgenpt/flutter_github_example/blob/9586530c98eaa28fedcfa45a86b0486279d82b51/ios/fastlane/Fastfile#L61 for the snippet :)

2

u/notrichardparker Feb 28 '22

Oh wow, I missed that completely. I will definitely be using that, thanks!

2

u/Alex54J Feb 27 '22

I give you 10/10 for this article, however my concern is that the IOS deployment process keeps changing and what works one day will fail the next time Apple decides to make a change. I don't think there is any substitute for learning the procedure inside out so the users knows what they are doing.

2

u/jorgenpt Feb 27 '22

It’s definitely a moving target, hopefully people will find a starting point helpful. Plus, fingers crossed that an active open source project like fastlane stays on top of it! 🤞

1

u/Isifdis Feb 27 '22

Hi how do you automate screenshots for App Store Connect with your method ?

2

u/jorgenpt Feb 27 '22

I don’t know — I have not done this yet myself as I am currently only using fastlane to manage builds & distribution. (I am only distributing via TestFlight at the moment.)

1

u/reddittrollguy Feb 27 '22

I have never used something like this. Should I consider github workflows over fastlane to get started?

2

u/jorgenpt Feb 27 '22

They are kind of different tools — my guide uses both — though they have some overlap. fastlane is a program that helps manage and perform the code signing and building, whereas the post uses GitHub workflows to decide when to run the fastlane operations, plus it uses GitHub’s free servers to run the operations on. You can also use fastlane to do this manually on your machine, but my setup is focused on making it happen automatically using GitHub’s free services.

1

u/andicom Feb 27 '22

Hey, thanks for the tutorial! Anyone has any good one for Google Play?

1

u/jorgenpt Feb 27 '22

Thanks! I’ll probably get to publishing betas on Android eventually, so unless I find a good resource then, I might write a guide for that too. ;)

3

u/ryanhanks Feb 28 '22

Semi-related: using self-hosted workflow runners was a game changer. They execute *significantly* faster (both start-up time and execution time), not to mention that you can ensure custom software is present in the environment, rather than installing it via actions at workflow time.

I understand this may not be a viable long-term CI solution for many, but bringing it up here bc it can help you get though that whole iteration process in much less time.