Class: Fastlane::Actions::PushToGitRemoteAction

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/actions/push_to_git_remote.rb

Overview

Adds a git tag to the current commit

Class Method Summary collapse

Class Method Details

.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
# File 'lib/fastlane/actions/push_to_git_remote.rb', line 5

def self.run(params)
  options = params.first

  remote        = (options && options[:remote]) || 'origin'
  force         = (options && options[:force]) || false
  local_branch  = (options && (options[:local_branch] || options[:branch])) || Actions.git_branch.gsub(/#{remote}\//, '') || 'master'
  remote_branch = (options && options[:remote_branch]) || local_branch

  # construct our command as an array of components
  command = [
    'git',
    'push',
    remote,
    "#{local_branch}:#{remote_branch}",
    '--tags'
  ]

  # optionally add the force component
  command << '--force' if force

  # execute our command
  puts Actions.sh('pwd')
  Actions.sh(command.join(' '))

  Helper.log.info 'Sucesfully pushed to remote.'
end