Class: Fastlane::Actions::PushVersionChangesAction

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

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



56
57
58
59
# File 'lib/fastlane/plugin/mobile_common/actions/push_version_changes.rb', line 56

def self.authors
  # So no one will ever forget your contribution to fastlane :) You are awesome btw!
  ["SemenovAlexander"]
end

.available_optionsObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/fastlane/plugin/mobile_common/actions/push_version_changes.rb', line 31

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :commit_message,
                                 env_name: "FL_PUSH_VERSION_CHANGES_COMMIT_MESSAGE",
                                 description: "Commit message for version bump",
                                 verify_block: proc do |value|
                                   UI.user_error!("No CommitMessage for PushVersionChangesAction given, pass using `commit_message: 'message'`") unless value and !value.empty?
                                 end),
    FastlaneCore::ConfigItem.new(key: :git_branch,
                                 env_name: "FL_PUSH_VERSION_CHANGES_GIT_BRANCH",
                                 description: "Branch to push changes",
                                 verify_block: proc do |value|
                                   UI.user_error!("No Git branch for PushVersionChangesAction given, pass using `git_branch: 'branch'`") unless value and !value.empty?
                                 end),
    FastlaneCore::ConfigItem.new(key: :xcodeproj,
                                 env_name: "FL_PUSH_VERSION_CHANGES_XCODEPROJ",
                                 description: "If you have multiple Xcode project files, you must specify your main project here",
                                 optional: true,
                                 verify_block: proc do |value|
                                   UI.user_error!("Please pass the path to the project, not the workspace") if value.end_with? ".xcworkspace"
                                   UI.user_error!("Could not find Xcode project at path '#{File.expand_path(value)}'") unless File.exist?(value)
                                 end)
  ]
end

.descriptionObject



27
28
29
# File 'lib/fastlane/plugin/mobile_common/actions/push_version_changes.rb', line 27

def self.description
  "Commits target version changes to repository and pushes created commit"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/fastlane/plugin/mobile_common/actions/push_version_changes.rb', line 61

def self.is_supported?(platform)
  [:ios, :mac].include?(platform)
end

.run(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fastlane/plugin/mobile_common/actions/push_version_changes.rb', line 7

def self.run(params)
  git_branch = params[:git_branch]

  # remove all files from index
  sh("git reset")

  other_action.commit_version_bump(
    force: true,
    message: params[:commit_message],
    xcodeproj: params[:xcodeproj]
  )
  other_action.push_to_git_remote(
    local_branch: git_branch
  )
end