Class: Fastlane::Actions::AndroidFinalizePrechecksAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



80
81
82
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb', line 80

def self.authors
  ['Automattic']
end

.available_optionsObject



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb', line 50

def self.available_options
  # Define all options your action supports.

  # Below a few examples
  [
    FastlaneCore::ConfigItem.new(key: :skip_confirm,
                                 env_name: 'FL_ANDROID_FINALIZE_PRECHECKS_SKIPCONFIRM',
                                 description: 'Skips confirmation',
                                 type: Boolean,
                                 default_value: false), # the default value if the user didn't provide one
    FastlaneCore::ConfigItem.new(key: :build_gradle_path,
                                 description: 'Path to the build.gradle file',
                                 type: String,
                                 optional: true,
                                 conflicting_options: [:version_properties_path]),
    FastlaneCore::ConfigItem.new(key: :version_properties_path,
                                 description: 'Path to the version.properties file',
                                 type: String,
                                 optional: true,
                                 conflicting_options: [:build_gradle_path]),
  ]
end

.descriptionObject



42
43
44
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb', line 42

def self.description
  'Runs some prechecks before finalizing a release'
end

.detailsObject



46
47
48
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb', line 46

def self.details
  'Runs some prechecks before finalizing a release'
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


84
85
86
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb', line 84

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

.outputObject



73
74
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb', line 73

def self.output
end

.return_valueObject



76
77
78
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb', line 76

def self.return_value
  'The current app version'
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
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb', line 8

def self.run(params)
  UI.message "Skip confirm: #{params[:skip_confirm]}"

  require_relative '../../helper/android/android_version_helper'
  require_relative '../../helper/android/android_git_helper'
  require_relative '../../helper/git_helper'

  current_branch = Fastlane::Helper::GitHelper.current_git_branch
  UI.user_error!("Current branch - '#{current_branch}' - is not a release branch. Abort.") unless current_branch.start_with?('release/')

  build_gradle_path = params[:build_gradle_path]
  version_properties_path = params[:version_properties_path]

  version = Fastlane::Helper::Android::VersionHelper.get_public_version(
    build_gradle_path: build_gradle_path,
    version_properties_path: version_properties_path
  )
  message = "Finalizing release: #{version}\n"
  if params[:skip_confirm]
    UI.message(message)
  else
    UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
  end

  # Check local repo status
  other_action.ensure_git_status_clean

  version[Fastlane::Helper::Android::VersionHelper::VERSION_NAME]
end