Fastlane + GitHub Actions + Slack App for iOS

Startup automation that boosts productivity by 200% (3)
DelightRoom's avatar
Feb 06, 2025
Fastlane + GitHub Actions + Slack App for iOS

Startup automation that boosts productivity by 200% (3)

Check deployment triggers, progress, and results right from Slack

What's the easiest way to prevent mistakes? In my opinion, it's double-checking. To ensure your code works flawlessly, you need to repeatedly check it against various test cases. I think this is one of the main reasons we need CI/CD. Continuous Integration (CI) and Continuous Deployment (CD) let you test frequently and catch errors fast. As I mentioned in this post, we didn't have an automated CI/CD pipeline up and running before. Instead, whoever needed to deploy would do so from their own MacBook using Fastlane. Since everyone had a different deployment environment, the process took forever, and sharing the results was a pain. It was high time for automation.

Cognitive load — In Felienne Hermans' book "The Programmer's Brain," she explains various concepts and methodologies based on cognitive science. Cognitive load refers to the amount of mental effort placed on a developer's working memory while performing a task. There is intrinsic load, extraneous load, and germane load. Cognitive load happens simply because the amount of information our working memory can process at once is limited.

Why do we even need automation? — It's to reduce the cognitive load caused by repetitive, manual tasks, allowing engineers to focus on core logic and solving important problems. By cutting down the unnecessary mental burden on our working memory, we can decrease cognitive load and improve both development efficiency and code quality.

Fastlane + GitHub Actions + Slack API

Fastlane was essential for automating our iOS builds and deployments. It provides almost every toolkit you could need, from Firebase Deploy to testing and App Store releases, and it's super easy to use. You could technically implement most of Fastlane's features just using GitHub Actions, but personally, I wasn't satisfied with the readability or productivity of that approach. You can also just call scripts, but I prefer using Fastlane. Fastlane has an active community, so when issues pop up, updates roll out fast. Recently, there was a bug where App Store deployments would fail if you used Xcode 16's Buildable Folder. It was raised in the community and resolved incredibly quickly.

Slack

The most crucial part of automation is the communication tool. It was important to let non-engineers monitor the deployment process too. We even made it possible for them to trigger deployments themselves. For more efficient communication, I developed a Slack app. As a side note, a single Slack app can only have up to five slash commands.

Fastlane

To send messages from Fastlane to Slack, I used slack-ruby-client. If you add the Thread Ts parameter to the Slack Post API, the message is sent as a reply to that specific Slack thread. This lets us manage the entire deployment process within a single thread. You can check out a sample Fastfile here. There's a lot of duplicate code and plenty of room for improvement, but it should be enough of a reference to help you build something better. As shown below, you can send the current build status straight to Slack.

...
  desc "Deploy a new version to the App Store"
  lane :release do |options|
    begin
      api_key = sign_app(adhoc: false)
      increase_build_number(api_key: api_key)

      build_number = get_build_number(
        xcodeproj: "./Modules/APP_NAME/APP_NAME.xcodeproj"
      )
      version_number = get_version_number(
        xcodeproj: "./Modules/APP_NAME/APP_NAME.xcodeproj",
        target: "APP_NAME"
      )

      options[:text] = "🏁 *빌드 시작! Version: #{version_number}(#{build_number})*"
      send_text_slack_message(options)
...
Simplified structure

GitHub Actions

GitHub Actions takes the requests and parameters received from Slack and passes them on to Fastlane. When you run a slash command, it forwards parameters like slack_channel, thread_ts, and release_note to Fastlane during execution. Depending on whether the GitHub Action succeeds or fails, it sends the final result back to Slack. Sample code

name: Deploy to AppStore

on:
  workflow_dispatch:
    inputs:
      slack_channel:
        description: "Slack Channel"
        required: false
        default: "group_ios_notifications"
        type: string
      slack_thread_ts:
        description: "Slack Thread TS"
        required: false
        default: null
        type: string
      release_notes:
        description: "Release Notes"
        required: false
        default: null
        type: string

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
        
jobs:
  build:
    runs-on: [self-hosted, m5-mac-pro]

...

Slack Block Kit

Using Slack Block Kit, you can easily build out the UI you want using various elements in a modular way. It makes generating UIs like the ones below a breeze.

The overall structure looks like the diagram below. A Slack command triggers GitHub Actions, which in turn runs the predefined Fastlane pipeline. At this point, we can pass along parameters like the Slack channel, thread info, release notes, and branch names, and we can also implement retry logic for when things fail. Finally, we set it up to send a success message or an error message back to Slack depending on the outcome.

Wrapping up

I've walked you through our iOS deployment automation workflow using Fastlane, GitHub Actions, and Slack. Through automation, we can break free from repetitive tasks and focus on more important engineering work, all while sharing the deployment process transparently with the entire team. In particular, this Slack-based trigger and monitoring system helps not just engineers, but PMs and QAs grasp the deployment status in real-time. It's great because we can respond immediately if a deployment fails and easily retry if needed. Automation isn't just a convenience feature; it's a critical element that maximizes team productivity and takes our development culture to the next level. We'll keep trying out different approaches to build the optimal engineering environment using automation.

If you have any questions or ideas for improvement, feel free to let me know! 🚀

Productivity series

What are some things in life you feel are a waste of time?

"Is this version done with App Store review?"

Fastlane + GitHub Actions + Slack App for iOS

Share article