Class: Fastlane::Actions::DeployAndroidAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/fossify/actions/deploy_android.rb

Class Method Summary collapse

Class Method Details

.available_optionsObject



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/fastlane/plugin/fossify/actions/deploy_android.rb', line 40

def self.available_options
  [
    opt(:flavor, required: true),
    opt(:package_name, required: true),
    opt(:json_key, required: true),
    opt(:metadata_path, required: false, default_value: 'fastlane/metadata/android'),
    opt(:track, required: false, default_value: 'production'),
    opt(:rollout, required: false, default_value: '0.05'),
    opt(:validate_only, required: false, type: Boolean, default_value: false)
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/fastlane/plugin/fossify/actions/deploy_android.rb', line 61

def self.is_supported?(platform)
  platform == :android
end

.opt(key, required:, **extra) ⇒ Object



52
53
54
55
56
57
58
59
# File 'lib/fastlane/plugin/fossify/actions/deploy_android.rb', line 52

def self.opt(key, required:, **extra)
  FastlaneCore::ConfigItem.new(
    key:,
    env_name: key.to_s.upcase, # Uppercase environment variable
    optional: !required,
    **extra
  )
end

.run(params) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/fastlane/plugin/fossify/actions/deploy_android.rb', line 8

def self.run(params)
  flavor = params[:flavor]
  build_type = 'Release'
  variant = "#{flavor}#{build_type}"
  Actions::GradleAction.run(
    task: 'bundle',
    flavor:,
    build_type:,
    project_dir: Dir.pwd,
    print_command: true,
    print_command_output: true
  )

  aab_pattern = "app/build/outputs/bundle/#{variant}/*.aab"
  aab_path = Dir[aab_pattern].first
  UI.user_error!("No AAB found at #{aab_pattern}") unless aab_path && File.exist?(aab_path)

  UI.message("AAB found at #{aab_path}")

  Actions::UploadToPlayStoreAction.run(
    rollout: params[:rollout],
    aab: aab_path,
    package_name: params[:package_name],
    json_key: params[:json_key],
    metadata_path: params[:metadata_path],
    skip_upload_apk: true,
    skip_upload_metadata: false,
    track: params[:track],
    validate_only: params[:validate_only]
  )
end