I'm trying to implement a CI/CD workflow for my Android project using Github Actions and Fastlane. I created a workflow to build and APK file and upload it to Firebase App Distribution. My workflow is triggered and succeed when I pushed to my development branch and uploads the APK file to Firebase App Distribution as expected.
But the same workflow is failed on master branch (without any code changes) with error: "bundler: command not found: fastlane"
When I call the same fastlane action on my local device, it works and uploads the APK to Firebase App Distribution.
Here is my lane:
lane :beta do |options|
version = options[:versionChange]
runUnitTests = options[:runUnitTests]
gitUserMail = options[:gitUserMail]
gitUserName = options[:gitUserName]
# 1- Make version code and name incrementation
if version.nil? || version == 'patch'
gradle(task: "doPatchVersionIncrement")
end
if version == 'major'
gradle(task: "doMajorVersionIncrement")
end
if version == 'minor'
gradle(task: "doMinorVersionIncrement")
end
gradle(task: "doBuildNumberIncrement")
gradle(task: "doBuildNumberBetaIncrementValueIncrement")
# 2- Run unit tests for all variants
if runUnitTests.nil? && runUnitTests != 'false'
gradle(task: "clean")
gradle(task: "test")
end
# 3- Build Release APK
gradle(task: "clean")
gradle(task: 'assemble', build_type: 'Release')
# 4- push version bump commit
properties = property_file_read(file: "app/version.properties")
versionMajor = properties['VERSION_NAME_MAJOR']
versionMinor = properties['VERSION_NAME_MINOR']
versionPatch = properties['VERSION_NAME_PATCH']
versionCode = properties['VERSION_CODE']
versionName = "#{versionMajor}.#{versionMinor}.#{versionPatch}"
if !gitUserMail.nil? && !gitUserMail.empty? && !gitUserName.nil? && !gitUserName.empty?
sh "git config --global user.email #{gitUserMail}; git config --global user.name #{gitUserName}"
end
sh "git add .. ; git commit -m 'Version bump : versionCode = #{versionCode} | versionName = #{versionName}'"
push_to_git_remote
# 5- Send APK to Firebase
firebase_app_distribution(app: "MY_FIREBASE_APP_ID", groups: "qa-team")
end
Here is my .yml file for GitHub Action:
name: Deploy Release APK to Firebase App Distribution
on:
push:
branches:
- "**"
pull_request:
branches:
- master
workflow_dispatch:
jobs:
upload_firebase_app_distribution:
name: Upload to Release Apk to Firebase App Distribution
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6'
bundler-cache: true
- name: Distribute app with ???? App Distribution ????
run: bundle exec fastlane beta version:patch runUnitTests:false gitUserMail:[email protected] gitUserName:user_name

