Class: Fastlane::Actions::PushToGitRemoteAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::PushToGitRemoteAction
- Defined in:
- fastlane/lib/fastlane/actions/push_to_git_remote.rb
Overview
Push local changes to the remote branch
Constant Summary
Constants inherited from Fastlane::Action
Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES
Class Method Summary collapse
- .author ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .run(params) ⇒ Object
Methods inherited from Fastlane::Action
action_name, authors, deprecated_notes, lane_context, method_missing, other_action, output, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text
Class Method Details
.author ⇒ Object
99 100 101 |
# File 'fastlane/lib/fastlane/actions/push_to_git_remote.rb', line 99 def self. "lmirosevic" end |
.available_options ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'fastlane/lib/fastlane/actions/push_to_git_remote.rb', line 50 def self. [ FastlaneCore::ConfigItem.new(key: :local_branch, env_name: "FL_GIT_PUSH_LOCAL_BRANCH", description: "The local branch to push from. Defaults to the current branch", default_value_dynamic: true, optional: true), FastlaneCore::ConfigItem.new(key: :remote_branch, env_name: "FL_GIT_PUSH_REMOTE_BRANCH", description: "The remote branch to push to. Defaults to the local branch", default_value_dynamic: true, optional: true), FastlaneCore::ConfigItem.new(key: :force, env_name: "FL_PUSH_GIT_FORCE", description: "Force push to remote", type: Boolean, default_value: false), FastlaneCore::ConfigItem.new(key: :force_with_lease, env_name: "FL_PUSH_GIT_FORCE_WITH_LEASE", description: "Force push with lease to remote", type: Boolean, default_value: false), FastlaneCore::ConfigItem.new(key: :tags, env_name: "FL_PUSH_GIT_TAGS", description: "Whether tags are pushed to remote", type: Boolean, default_value: true), FastlaneCore::ConfigItem.new(key: :remote, env_name: "FL_GIT_PUSH_REMOTE", description: "The remote to push to", default_value: 'origin'), FastlaneCore::ConfigItem.new(key: :no_verify, env_name: "FL_GIT_PUSH_USE_NO_VERIFY", description: "Whether or not to use --no-verify", type: Boolean, default_value: false), FastlaneCore::ConfigItem.new(key: :set_upstream, env_name: "FL_GIT_PUSH_USE_SET_UPSTREAM", description: "Whether or not to use --set-upstream", type: Boolean, default_value: false), FastlaneCore::ConfigItem.new(key: :push_options, env_name: "FL_GIT_PUSH_PUSH_OPTION", description: "Array of strings to be passed using the '--push-option' option", type: Array, default_value: []) ] end |
.category ⇒ Object
130 131 132 |
# File 'fastlane/lib/fastlane/actions/push_to_git_remote.rb', line 130 def self.category :source_control end |
.description ⇒ Object
46 47 48 |
# File 'fastlane/lib/fastlane/actions/push_to_git_remote.rb', line 46 def self.description "Push local changes to the remote branch" end |
.details ⇒ Object
103 104 105 106 107 108 |
# File 'fastlane/lib/fastlane/actions/push_to_git_remote.rb', line 103 def self.details [ "Lets you push your local commits to a remote git repo. Useful if you make local changes such as adding a version bump commit (using `commit_version_bump`) or a git tag (using 'add_git_tag') on a CI server, and you want to push those changes back to your canonical/main repo.", "If this is a new branch, use the `set_upstream` option to set the remote branch as upstream." ].join("\n") end |
.example_code ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'fastlane/lib/fastlane/actions/push_to_git_remote.rb', line 114 def self.example_code [ 'push_to_git_remote # simple version. pushes "master" branch to "origin" remote', 'push_to_git_remote( remote: "origin", # optional, default: "origin" local_branch: "develop", # optional, aliased by "branch", default is set to current branch remote_branch: "develop", # optional, default is set to local_branch force: true, # optional, default: false force_with_lease: true, # optional, default: false tags: false, # optional, default: true no_verify: true, # optional, default: false set_upstream: true # optional, default: false )' ] end |
.is_supported?(platform) ⇒ Boolean
110 111 112 |
# File 'fastlane/lib/fastlane/actions/push_to_git_remote.rb', line 110 def self.is_supported?(platform) true end |
.run(params) ⇒ Object
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 'fastlane/lib/fastlane/actions/push_to_git_remote.rb', line 5 def self.run(params) local_branch = params[:local_branch] local_branch ||= Actions.git_branch.gsub(%r{#{params[:remote]}\/}, '') if Actions.git_branch UI.user_error!('Failed to get the current branch.') unless local_branch remote_branch = params[:remote_branch] || local_branch # construct our command as an array of components command = [ 'git', 'push', params[:remote], "#{local_branch.shellescape}:#{remote_branch.shellescape}" ] # optionally add the tags component command << '--tags' if params[:tags] # optionally add the force component command << '--force' if params[:force] # optionally add the force component command << '--force-with-lease' if params[:force_with_lease] # optionally add the no-verify component command << '--no-verify' if params[:no_verify] # optionally add the set-upstream component command << '--set-upstream' if params[:set_upstream] # optionally add the --push_options components params[:push_options].each { |push_option| command << "--push-option=#{push_option}" } # execute our command Actions.sh('pwd') return command.join(' ') if Helper.test? Actions.sh(command.join(' ')) UI.('Successfully pushed to remote.') end |