maierj / fastlane-action

A GitHub action for executing fastlane lanes.
MIT License
321 stars 38 forks source link

bundler: failed to load command: fastlane #76

Closed btrautmann closed 3 years ago

btrautmann commented 3 years ago

I'm running into what I think is the same issue as seen in https://github.com/maierj/fastlane-action/issues/64 except on older versions of ruby that should be supported.

My entire Github workflow is the following:

jobs:
  deploy-mobile:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v2
      - uses: subosito/flutter-action@v1
        with:
          flutter-version: '2.2.2'
          channel: stable
      - uses: ruby/setup-ruby@v1.81.0
        with:
          ruby-version: '2.6.5'
          bundler-cache: true

      - name: Deploy Android
        env:
          ANDROID_KEYSTORE_PATH: ${{secrets.ANDROID_KEYSTORE_PATH}}
          ANDROID_SECRET_JSON_FILE: ${{secrets.ANDROID_SECRET_JSON_FILE}}
        uses: maierj/fastlane-action@v2.0.1
        with:
          lane: 'deploy'
          subdirectory: 'android'

And my Fastfile is simply:

update_fastlane

default_platform(:android)

open_weather_map_api_key = ENV["OPEN_WEATHER_MAP_API_KEY"]
json_key_data = ENV["ANDROID_SECRET_JSON_FILE"]

platform :android do
  desc "Deploy a new version to the Google Play"
  lane :deploy do
    sh("flutter", "clean")
    sh("flutter", "packages", "get")
    sh("flutter", "build", "appbundle", "-dart-define=OPEN_WEATHER_MAP_API_KEY=#{open_weather_map_api_key}", "--flavor=production", "--target=lib/main_production.dart")

    upload_to_play_store(
      track: "beta",
      aab: "../build/app/outputs/bundle/productionRelease/app-production-release.aab",
      skip_upload_screenshots: true,
      skip_upload_images: true,
      json_key_data: "#{json_key_data}")
  end
end

However, the build fails with the following error:

bundler: failed to load command: fastlane (/Users/runner/hostedtoolcache/Ruby/2.6.5/x64/bin/fastlane)
/Users/runner/hostedtoolcache/Ruby/2.6.5/x64/lib/ruby/gems/2.6.0/gems/fastlane-2.194.0/fastlane_core/lib/fastlane_core/ui/interface.rb:153:in `shell_error!': [!] Exit status of command 'flutter build appbundle -dart-define\=OPEN_WEATHER_MAP_API_KEY\= --flavor\=production --target\=lib/main_production.dart' was 1 instead of 0. (FastlaneCore::Interface::FastlaneShellError)

I have tried various ruby versions between 2.6 and 3.0.0 (by the way, it looks like Fastlane now supports ruby 3.0.0). I have trued both on ubuntu-latest and macos-latest platforms but none seem to work.

I am not sure what else to try, so I'm hoping there's something obvious going on...

btrautmann commented 3 years ago

I suspect that this error is actually a red herring, and I'm going to close it for now.

For anyone that finds themselves in a similar situation, passing -v to the flutter build command has unearthed what I think are new clues to look into.