Class: Fastlane::Actions::CommitVersionAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/ravn_mobile/actions/commit_version_action.rb

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



53
54
55
# File 'lib/fastlane/plugin/ravn_mobile/actions/commit_version_action.rb', line 53

def self.authors
  ['quebin31']
end

.available_optionsObject



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/fastlane/plugin/ravn_mobile/actions/commit_version_action.rb', line 39

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :message,
                                 env_name: 'FL_COMMIT_VERSION_MESSAGE',
                                 description: 'Commit message',
                                 type: String,
                                 default_value: 'chore: Version bump'),
    FastlaneCore::ConfigItem.new(key: :xcodeproj,
                                 env_name: 'FL_COMMIT_VERSION_XCODEPROJ',
                                 description: 'Xcodeproj if running for iOS',
                                 optional: true)
  ]
end

.descriptionObject



31
32
33
# File 'lib/fastlane/plugin/ravn_mobile/actions/commit_version_action.rb', line 31

def self.description
  'Commit version change for iOS and Android projects'
end

.detailsObject



35
36
37
# File 'lib/fastlane/plugin/ravn_mobile/actions/commit_version_action.rb', line 35

def self.details
  'Commits changes made to version code, supports Android (via gradle.properties) and iOS'
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/fastlane/plugin/ravn_mobile/actions/commit_version_action.rb', line 57

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

.run(params) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fastlane/plugin/ravn_mobile/actions/commit_version_action.rb', line 8

def self.run(params)
  xcodeproj = params[:xcodeproj]
  message = params[:message]

  if Helper::FrameworkHelper.is_expo?
    # noinspection RubyResolve
    other_action.git_commit(path: ['app.json'], message: message)
  elsif !blank?(xcodeproj)
    # noinspection RubyResolve
    other_action.commit_version_bump(message: message, xcodeproj: xcodeproj)
  else
    project_dir = Helper::FrameworkHelper.is_react_native? || Helper::FrameworkHelper.is_flutter? ? 'android/' : './'
    properties_path = File.join(project_dir, 'gradle.properties')

    # noinspection RubyResolve
    other_action.git_commit(path: [properties_path], message: message)
  end
end