Class: Fastlane::Actions::IosBumpVersionReleaseAction

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

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



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

def self.authors
  ['Automattic']
end

.available_optionsObject



45
46
47
48
49
50
51
52
53
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb', line 45

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :default_branch,
                                 env_name: 'FL_RELEASE_TOOLKIT_DEFAULT_BRANCH',
                                 description: 'Default branch of the repository',
                                 type: String,
                                 default_value: Fastlane::Helper::GitHelper::DEFAULT_GIT_BRANCH),
  ]
end

.create_configObject



69
70
71
72
73
74
75
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb', line 69

def self.create_config
  @current_version = Fastlane::Helper::Ios::VersionHelper.get_build_version
  @current_version_internal = Fastlane::Helper::Ios::VersionHelper.get_internal_version unless ENV['INTERNAL_CONFIG_FILE'].nil?
  @new_version_internal = Fastlane::Helper::Ios::VersionHelper.create_internal_version(@new_version) unless ENV['INTERNAL_CONFIG_FILE'].nil?
  @new_short_version = Fastlane::Helper::Ios::VersionHelper.get_short_version_string(@new_version)
  @new_release_branch = "release/#{@new_short_version}"
end

.descriptionObject



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

def self.description
  'Bumps the version of the app and creates the new release branch'
end

.detailsObject



41
42
43
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb', line 41

def self.details
  'Bumps the version of the app and creates the new release branch'
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb', line 65

def self.is_supported?(platform)
  %i[ios mac].include?(platform)
end

.outputObject



55
56
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb', line 55

def self.output
end

.return_valueObject



58
59
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb', line 58

def self.return_value
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
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb', line 4

def self.run(params)
  # fastlane will take care of reading in the parameter and fetching the environment variable:
  UI.message 'Bumping app release version...'

  require_relative '../../helper/ios/ios_version_helper'
  require_relative '../../helper/ios/ios_git_helper'

  default_branch = params[:default_branch]
  other_action.ensure_git_branch(branch: default_branch)

  # Create new configuration
  @new_version = Fastlane::Helper::Ios::VersionHelper.bump_version_release
  create_config
  show_config

  # Update local default branch and create branch from it
  Fastlane::Helper::GitHelper.checkout_and_pull(default_branch)
  Fastlane::Helper::GitHelper.create_branch(@new_release_branch, from: default_branch)
  UI.message 'Done!'

  UI.message 'Updating XcConfig...'
  Fastlane::Helper::Ios::VersionHelper.update_xc_configs(@new_version, @new_short_version, @new_version_internal)
  UI.message 'Done!'

  Fastlane::Helper::Ios::GitHelper.commit_version_bump

  UI.message 'Done.'
end

.show_configObject



77
78
79
80
81
82
83
84
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb', line 77

def self.show_config
  UI.message("Current build version: #{@current_version}")
  UI.message("Current internal version: #{@current_version_internal}") unless ENV['INTERNAL_CONFIG_FILE'].nil?
  UI.message("New build version: #{@new_version}")
  UI.message("New internal version: #{@new_version_internal}") unless ENV['INTERNAL_CONFIG_FILE'].nil?
  UI.message("New short version: #{@new_short_version}")
  UI.message("Release branch: #{@new_release_branch}")
end