Class: Fastlane::Actions::AndroidCompletecodefreezePrechecksAction

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

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



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

def self.authors
  ['Automattic']
end

.available_optionsObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_completecodefreeze_prechecks.rb', line 46

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :skip_confirm,
                                 env_name: 'FL_ANDROID_COMPLETECODEFREEZE_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



38
39
40
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_completecodefreeze_prechecks.rb', line 38

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

.detailsObject



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

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

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


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

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

.outputObject



66
67
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_completecodefreeze_prechecks.rb', line 66

def self.output
end

.return_typeObject



69
70
71
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_completecodefreeze_prechecks.rb', line 69

def self.return_type
  :string
end

.return_valueObject



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

def self.return_value
  'The version number that has been prechecked.'
end

.run(params) ⇒ Object



4
5
6
7
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
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_completecodefreeze_prechecks.rb', line 4

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 = "Completing code freeze for: #{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
end