Class: Fastlane::Actions::AndroidBumpVersionFinalReleaseAction

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

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



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

def self.authors
  ['Automattic']
end

.available_optionsObject



58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_final_release.rb', line 58

def self.available_options
  [
    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



50
51
52
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_final_release.rb', line 50

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

.detailsObject



54
55
56
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_final_release.rb', line 54

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

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


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

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_final_release.rb', line 4

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

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

  # Verify that the current branch is a release branch. Notice that `ensure_git_branch` expects a RegEx parameter
  ensure_git_branch(branch: '^release/')

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

  current_version = Fastlane::Helper::Android::VersionHelper.get_release_version(
    build_gradle_path: build_gradle_path,
    version_properties_path: version_properties_path
  )
  current_version_alpha = Fastlane::Helper::Android::VersionHelper.get_alpha_version(
    build_gradle_path: build_gradle_path,
    version_properties_path: version_properties_path
  )
  final_version = Fastlane::Helper::Android::VersionHelper.calc_final_release_version(current_version, current_version_alpha)

  vname = Fastlane::Helper::Android::VersionHelper::VERSION_NAME
  vcode = Fastlane::Helper::Android::VersionHelper::VERSION_CODE
  UI.message("Current version: #{current_version[vname]}(#{current_version[vcode]})")
  UI.message("Current alpha version: #{current_version_alpha[vname]}(#{current_version_alpha[vcode]})") unless current_version_alpha.nil?
  UI.message("New release version: #{final_version[vname]}(#{final_version[vcode]})")

  UI.message 'Updating app version...'
  Fastlane::Helper::Android::VersionHelper.update_versions(
    final_version,
    current_version_alpha,
    version_properties_path: version_properties_path
  )
  UI.message 'Done!'

  Fastlane::Helper::Android::GitHelper.commit_version_bump(
    build_gradle_path: build_gradle_path,
    version_properties_path: version_properties_path
  )
end