I have been building my mobile pipelines both react-native and flutter pretty much the normal way. I am trying to get this first time fastlane pipeline up and so far it's been a bit rough. It's a react-native project with both android and iOS folders. I am following this blog https://blog.logrocket.com/fastlane-build-test-ship-react-native-apps/ so my setup is similar. Just that I am doing a firebase distribution lane. On the GitHub action, the actions/setup-ruby@v1
has been replaced by ruby/setup-ruby@v1
.
The build always fails with the following even when a set like : ruby --version still shows 2.7.7
/opt/hostedtoolcache/Ruby/2.7.7/x64/lib/ruby/gems/2.7.0/gems/bundler-2.2.27/lib/bundler/definition.rb:441:in `validate_ruby!': Your Ruby version is 3.0.2, but your Gemfile specified 2.7.7
Been scratching my hair for the past few hours on what I could be possibly doing wrong. Below is the GitHub actions
name: Android developer build
on:
push:
branches:
- feat/splitting-dev-from-uat-builds
# - develop*
# - feat/*
jobs:
android-build:
name: Android Build
runs-on: ubuntu-latest
environment: dev
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup JDK
uses: actions/setup-java@v1
with:
java-version: 8
- name: Install npm dependencies
run: |
yarn install
- uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
- name: Checking Ruby Component versions
run: |
ruby --version
# gem install bundler
# gem install fastlane
# # Install the Firebase app distribution plugin with fastlane
# - name: Install Firebase app distribution plugin
# run: bundle exec fastlane add_plugin firebase_app_distribution
# Create a keystore file out of it's base64 string version from secrets
- name: Recreate android key store file
id: write_keysotre_file
uses: timheuer/base64-to-file@v1.2
with:
fileName: ${{ vars.DEV_ANDROID_KEYSTORE_NAME }}
fileDir: ${{ vars.DEV_ANDROID_KEYSTORE_FOLDER_PATH }}
encodedString: ${{ secrets.DEV_ANDROID_KEYSTORE_BASE64_FILE }}
- name: distribute to firebase
run: bundle exec fastlane android alpha
env:
FIREBASE_CLI_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }}
FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }}
ANDROID_KEYSTORE_FILE: ${{ vars.DEV_ANDROID_KEYSTORE_FOLDER_PATH }}/${{ vars.DEV_ANDROID_KEYSTORE_NAME }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.DEV_ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEYSTORE_KEY_ALIAS: ${{ secrets.DEV_ANDROID_KEYSTORE_KEY_ALIAS }}
FIREBASE_DIST_GROUP: dev-android
The main Fastfile looks like the following
platform :android do
desc "This is a dev release, we will call it alpha"
lane :alpha do
increment_version_code(app_project_dir:'./android/app')
increment_version_name(app_project_dir: './android/app', bump_type: 'patch')
gradle(task: 'clean',project_dir: './android')
gradle(task: 'assemble', bundle_type: 'Release', project_dir: './android', properties:{
"android.injected.signing.store.file" => ENV['ANDROID_KEYSTORE_FILE'],
"android.injected.signing.store.password" => ENV['ANDROID_KEYSTORE_PASSWORD'],
"android.injected.signing.key.alias" => ENV['ANDROID_KEYSTORE_KEY_ALIAS']
})
output_path = "./android/app/build/outputs/apk/"
firebase_app_distribution(
app: ENV['FIREBASE_APP_ID'],
firebase_cli_token: ENV['FIREBASE_CLI_TOKEN'],
groups: ENV['FIREBASE_DIST_GROUP'],
release_notes: "Git commit: #{last_git_commit[:abbreviated_commit_hash]}",
)
end
end
If you do not want to deep dive you can try to change ruby version to 3.0.2 in your actions file or in your .ruby-version file and Gemfile