bskim45 / fastlane-plugin-google_drive

fastlane plugin to upload files to Google Drive
https://rubygems.org/gems/fastlane-plugin-google_drive
MIT License
53 stars 16 forks source link

Couldn't find config keyfile at path 'drive_key.json' #37

Open KevinJ1008 opened 1 month ago

KevinJ1008 commented 1 month ago

No matter where drive_key.json file I place, the plugin always throw file not exist error to me, when I use this plugin in Flutter project

  desc "Run Android debug build"
  lane :debug_build do
    Dir.chdir "../.." do
      sh("flutter", "packages", "get")
      sh("flutter", "clean")
      sh("flutter", "build", "apk", "--debug", "-t", "lib/main_stag.dart", "--flavor", "stag", "-v")
      ENV["DEBUG_APK_PATH"] = sh("find", ".", "-name", "debug*.apk").strip
      puts ENV["DEBUG_APK_PATH"]
    end
  end

  desc "Build a new Android debug App to Dropbox"
  lane :dev_deploy do
    debug_build
    // I place `drive_key.json` in root project
    Dir.chdir "../.." do
      upload_to_google_drive(
        drive_keyfile: 'drive_key.json',
        service_account: true,
        folder_id: 'GOOGLE_DRIVE_FOLDER_ID',
        upload_files: [ENV["DEBUG_APK_PATH"]]
      )
    end

    // Same error below if I don't run in root
    upload_to_google_drive(
      drive_keyfile: '../android/fastlane/drive_key.json',
      service_account: true,
      folder_id: 'GOOGLE_DRIVE_FOLDER_ID',
      upload_files: [ENV["DEBUG_APK_PATH"]]
    )
  end

image

bskim45 commented 1 month ago

Can you share your project structure? You can also refer to the official documentation about chdir: https://docs.fastlane.tools/advanced/fastlane/#directory-behavior