Class: Fastlane::Actions::AndroidBumpVersionHotfixAction

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

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



57
58
59
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_hotfix.rb', line 57

def self.authors
  ['Automattic']
end

.available_optionsObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_hotfix.rb', line 41

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :version_name,
                                 env_name: 'FL_ANDROID_BUMP_VERSION_HOTFIX_VERSION',
                                 description: 'The version name for the hotfix',
                                 is_string: true),
    FastlaneCore::ConfigItem.new(key: :version_code,
                                 env_name: 'FL_ANDROID_BUMP_VERSION_HOTFIX_CODE',
                                 description: 'The version code for the hotfix'),
    FastlaneCore::ConfigItem.new(key: :previous_version_name,
                                 env_name: 'FL_ANDROID_BUMP_VERSION_HOTFIX_PREVIOUS_VERSION',
                                 description: 'The version to branch from',
                                 is_string: true),
  ]
end

.descriptionObject



33
34
35
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_hotfix.rb', line 33

def self.description
  'Bumps the version of the app for a new beta.'
end

.detailsObject



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

def self.details
  'Bumps the version of the app for a new beta.'
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_hotfix.rb', line 61

def self.is_supported?(platform)
  platform == :android
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
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_hotfix.rb', line 4

def self.run(params)
  UI.message 'Bumping app release version for hotfix...'

  require_relative '../../helper/android/android_git_helper'
  Fastlane::Helper::GitHelper.create_branch("release/#{params[:version_name]}", from: params[:previous_version_name])

  current_version = Fastlane::Helper::Android::VersionHelper.get_release_version
  new_version = Fastlane::Helper::Android::VersionHelper.calc_next_hotfix_version(params[:version_name], params[:version_code]) # NOTE: this just puts the name/code values in a tuple, unchanged (no actual calc/bumping)
  new_release_branch = "release/#{params[:version_name]}"

  name_key = Fastlane::Helper::Android::VersionHelper::VERSION_NAME
  code_key = Fastlane::Helper::Android::VersionHelper::VERSION_CODE
  UI.message("Current version: #{current_version[name_key]} (#{current_version[code_key]})")
  UI.message("New hotfix version: #{new_version[name_key]} (#{new_version[code_key]})")
  UI.message("Release branch: #{new_release_branch}")

  UI.message 'Updating app version...'
  Fastlane::Helper::Android::VersionHelper.update_versions(new_version, nil)
  UI.message 'Done!'

  Fastlane::Helper::Android::GitHelper.commit_version_bump()

  UI.message 'Done.'
end