Favicon

You are here: Home > App Distribution > CI/CD > Fastlane

Fastlane

Learn how to automate your iOS and Android app releases using Fastlane and the Applivery plugin. Streamline building, testing, and distribution.

10 min read

TL;DR

Automate your iOS and Android app releases to Applivery using the Fastlane plugin, streamlining the build, upload, and notification process.

fastlane

Fastlane is an open-source automation tool for iOS and Android developers that handles building, testing, code signing, and releasing apps. The Applivery Fastlane plugin extends Fastlane with an applivery action that uploads a built binary to Applivery, attaches CI metadata (commit, branch, tag, repository URL), and optionally sends notifications — all in one step.


Prerequisites

  • Fastlane installed on your system or CI agent.
  • An Applivery App API Token. Find it in App Settings → API Tokens in the Applivery dashboard, or see Apps API Token.
  • A Fastfile in your project with at least one lane defined.

1
Install the Plugin

In your project directory, run:

fastlane add_plugin applivery

This adds the plugin to your Pluginfile and installs it. Commit the updated Pluginfile and Gemfile.lock to your repository so the plugin is automatically available on CI.

2
Configure your Fastfile

Add an applivery action to any lane in your Fastfile. The only required parameter is app_token. All other parameters are optional.

iOS example

platform :ios do
  lane :deploy do
    # Build the app
    gym(
      scheme: "MyApp",
      export_method: "enterprise"   # or "ad-hoc"
    )

    # Upload to Applivery
    applivery(
      app_token: ENV["APPLIVERY_TOKEN"],
      name: "v#{get_version_number} (#{last_git_commit[:abbreviated_commit_hash]})",
      changelog: last_git_commit[:message],
      notify_collaborators: true,
      notify_message: "New build ready for testing",
      tags: "ios, staging"
    )

    puts "Build uploaded. ID: #{lane_context[SharedValues::APPLIVERY_BUILD_ID]}"
  end
end

Android example

platform :android do
  lane :deploy do
    # Build the APK
    gradle(task: "assembleRelease")

    # Upload to Applivery
    applivery(
      app_token: ENV["APPLIVERY_TOKEN"],
      name: "v#{android_get_version_name}",
      changelog: last_git_commit[:message],
      notify_collaborators: true,
      notify_message: "New Android build available",
      tags: "android, staging"
    )
  end
end

Running the lane

fastlane ios deploy
fastlane android deploy

Plugin parameters

Parameter Type Required Description
app_token String Yes Your Applivery App API Token. Available in App Settings → API Tokens.
name String No Human-readable build name shown in the Applivery dashboard. E.g. RC 1.0, v2.4.0-beta.
changelog String No Release notes or change description for this build.
notify_collaborators Boolean No Send an email notification to app collaborators after the upload. Default: false.
notify_employees Boolean No Send an email notification to store employees after the upload. Default: false.
notify_message String No Custom message included in the notification email.
tags String No Comma-separated tags to label the build. E.g. "staging, sprint-42".
filter String No Notification group filter. Comma-separated for AND, pipe-separated for OR. E.g. "group1,group2|group3" means (group1 AND group2) OR (group3).
build_path String No Explicit path to the binary to upload. By default, uses the path produced by gym() (iOS) or gradle() (Android).

Shared values

After a successful upload, the plugin exposes the resulting build ID as a Fastlane shared value. You can use it in subsequent lane steps — for example, to trigger further automation, update a publication, or log the result.

applivery(
  app_token: ENV["APPLIVERY_TOKEN"]
)

build_id = lane_context[SharedValues::APPLIVERY_BUILD_ID]
puts "Uploaded build ID: #{build_id}"

Storing the Token securely

Never hardcode your App Token directly in the Fastfile. Use one of the following approaches depending on your setup:

Environment variable (recommended for CI):

applivery(
  app_token: ENV["APPLIVERY_TOKEN"]
)

Set APPLIVERY_TOKEN as a secret environment variable in your CI platform (Bitrise, Azure Pipelines, GitHub Actions, Jenkins, etc.).

Fastlane .env file (recommended for local development):

Create a .env file in your fastlane/ directory (add it to .gitignore):

APPLIVERY_TOKEN=your_token_here

Fastlane automatically loads .env files. Reference the variable the same way: ENV["APPLIVERY_TOKEN"].


Complete Fastfile example

A real-world Fastfile with separate iOS and Android deploy lanes, using Git metadata for the changelog and build name:

# fastlane/Fastfile

default_platform(:ios)

platform :ios do
  desc "Build and deploy to Applivery"
  lane :deploy do
    increment_build_number(build_number: number_of_commits)

    gym(
      scheme: "MyApp-Staging",
      export_method: "enterprise",
      output_directory: "./build",
      output_name: "MyApp.ipa"
    )

    applivery(
      app_token: ENV["APPLIVERY_TOKEN"],
      name: "#{get_version_number} (#{last_git_commit[:abbreviated_commit_hash]})",
      changelog: last_git_commit[:message],
      notify_collaborators: true,
      notify_message: "New iOS build — #{git_branch}",
      tags: "ios, #{git_branch}"
    )

    puts "✅ Uploaded to Applivery. Build ID: #{lane_context[SharedValues::APPLIVERY_BUILD_ID]}"
  end
end

platform :android do
  desc "Build and deploy to Applivery"
  lane :deploy do
    gradle(
      task: "assemble",
      build_type: "Release"
    )

    applivery(
      app_token: ENV["APPLIVERY_TOKEN"],
      name: "#{android_get_version_name} (#{last_git_commit[:abbreviated_commit_hash]})",
      changelog: last_git_commit[:message],
      notify_collaborators: true,
      notify_message: "New Android build — #{git_branch}",
      tags: "android, #{git_branch}"
    )

    puts "✅ Uploaded to Applivery. Build ID: #{lane_context[SharedValues::APPLIVERY_BUILD_ID]}"
  end
end

Key Takeaways

  • The Fastlane Applivery plugin simplifies app distribution.
  • Securely store your Applivery API token using environment variables or .env files.
  • Configure your Fastfile to automate build uploads and notifications.
  • Use shared values to integrate the plugin with other Fastlane actions.
  • The plugin supports both iOS and Android platforms.