Skip to main content

GitHub Action with Fastlane Plugin

GitHub Action with TestApp.io Fastlane Plugin allows you to build and upload both Android & iOS apps and notify your testers for feedback

Updated over 2 years ago

💡BETA mode. Your feedback is highly appreciated!

GitHub Action with TestApp.io Fastlane Plugin allows you to build and upload both Android & iOS apps to TestApp.io to notify your testers for testing and feedback.

Configuration

Key

Description

Env Var(s)

Default

api_token

TESTAPPIO_API_TOKEN

app_id

You can get it from your app page at https://portal.testapp.io/apps

TESTAPPIO_APP_ID

release

It can be either both Android or iOS

TESTAPPIO_RELEASE

apk

Path to the Android APK file

TESTAPPIO_ANDROID_PATH

ipa

Path to the iOS IPA file

TESTAPPIO_IOS_PATH

release_notes

Manually add the release notes to be displayed for the testers.

TESTAPPIO_RELEASE_NOTES

git_release_notes

Collect release notes from the latest git commit message to be displayed for the testers: true or false

TESTAPPIO_GIT_RELEASE_NOTES

true

git_commit_id

Include the last commit ID in the release notes (works with both release notes options): true or false

TESTAPPIO_GIT_COMMIT_ID

false

notify

Send notifications to your team members about this release: true or false

TESTAPPIO_NOTIFY

false

Check TA-CLI for more info


iOS

We will demonstrate with our sample iOS project, testappio-ios-sample-app to show how GitHub Action + Fastlane + TestApp plugin works.

Configure iOS project for Fastlane

1. Install Fastlane

The below command works for most cases. If not, please read this - Setup Fastlane

bundle install fastlane

2. Init Fastlane

In the iOS project folder

bundle exec fastlane init

And follow the wizard; it will create ./fastlane/Appfile with your Apple ID and team.

3. Init Match

Fastlane match is a tool for generating all necessary certificates, provisioning profiles, and storing them in a Git repository encrypted.

Create a private empty GitHub repository for storing certificates and provisioning profiles.

bundle exec fastlane match init

Follow the instruction, give the new empty git repository when asked, and it will create the Matchfile.

💡This Git repository will be used to store your certificates and profiles

4. Generate the certificate and provision profile

bundle exec fastlane match adhoc

Following the instruction, it will generate certificates/profiles and store them in the Git repository specified in the previous step.

💡Provide a matching password for encrypting the certificates and profiles in the Git repository.

5. Select provisioning profiles in Xcode

The newly created certificates and profiles should now be possible to select inside our project. Open up Xcode and go to Signing & Capabilities.

⚠️ Please don't choose Automatically Manage Signing

6. Using testappio plugin for Fastlane

bundle exec fastlane add_plugin testappio

7. Create a Repository level Secret MATCH_PASSWORD this is the one you specified while generating the Certificates and Profiles.

How to configure secrets for GitHub Actions

8. Create a Repository level Secret FASTLANE_PASSWORD this is the password of your Apple ID.

9. Create a Repository level Secret MATCH_GIT_BASIC_AUTHORIZATION for accessing the Certification/Profile repository.

Navigate to Tokens to generate a Personal Access Token, MATCH_GIT_BASIC_AUTHORIZATION can be generated below

echo -n your_github_username:your_personal_access_token | base64

10. Create Repository level Secrets TESTAPPIO_API_TOKEN and TESTAPPIO_APP_ID

Run the pipeline

11. Finally, create the lane

Create: ./fastlane/Fastfile And copy the below content:

default_platform(:ios)

platform :ios do

desc "Build the adhoc and upload to TestApp.io"
lane :development do
match(type: "adhoc")
gym(export_method: "ad-hoc")
upload_to_testappio(
release_notes: "My release notes here..."
)
end

end

You may already have your lane in place; copy the upload_to_testappio action and put it into your pipeline after the IPA export.

12. The GitHub Workflow:

Create: .github/workflows/ios.yml File under your project root folder. E.g.

name: Build & upload IPA to TestApp.io

on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
ios:
name: Build and upload to TestApp.io
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7.2'
- uses: maierj/[email protected]
env:
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
TESTAPPIO_API_TOKEN: ${{ secrets.TESTAPPIO_API_TOKEN }}
TESTAPPIO_APP_ID: ${{ secrets.TESTAPPIO_APP_ID }}
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
with:
lane: 'ios development'
verbose: true

13. Commit and push the change to trigger the GitHub Action.


Android

With our sample Android project testappio-android-sample, we will demonstrate how the GitHub Action + Fastlane + TestApp plugin works.

1. Create Repository level Secrets TESTAPPIO_API_TOKEN and TESTAPPIO_APP_ID

2. Create .github/workflows/main.yml file

name: Build & upload APK to TestApp.io

on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
ios:
name: Build and upload to TestApp.io
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7.2'
- uses: maierj/[email protected]
env:
TESTAPPIO_API_TOKEN: ${{ secrets.TESTAPPIO_API_TOKEN }}
TESTAPPIO_APP_ID: ${{ secrets.TESTAPPIO_APP_ID }}
with:
lane: 'android development'
verbose: true

3. Create fastlane/Fastfile file

default_platform(:android)

platform :android do

desc "Submit a new Build to TestApp.io"
lane :development do

increment_version_code

gradle(task: "clean assembleDebug")

upload_to_testappio(
release_notes: "My release notes here..."
)
end
end

4. Commit and push the change to trigger the GitHub Action


Feedback & Support

Developers built TestApp.io to solve the pain of app distribution for mobile app development teams.

Join our community for feedback and support.

Happy releasing 🎉

Did this answer your question?