class Pantograph::Actions::PushGitTagsAction

Public Class Methods

author() click to toggle source
# File pantograph/lib/pantograph/actions/push_git_tags.rb, line 53
def self.author
  ['vittoriom']
end
available_options() click to toggle source
# File pantograph/lib/pantograph/actions/push_git_tags.rb, line 33
def self.available_options
  [
    PantographCore::ConfigItem.new(key: :force,
                                 env_name: 'PUSH_GIT_FORCE',
                                 description: 'Force push to remote',
                                 is_string: false,
                                 default_value: false,
                                 optional: true),
    PantographCore::ConfigItem.new(key: :remote,
                                 env_name: 'GIT_PUSH_REMOTE',
                                 description: 'The remote to push tags to',
                                 default_value: 'origin',
                                 optional: true),
    PantographCore::ConfigItem.new(key: :tag,
                                 env_name: 'GIT_PUSH_TAG',
                                 description: 'The tag to push to remote',
                                 optional: true)
  ]
end
category() click to toggle source
# File pantograph/lib/pantograph/actions/push_git_tags.rb, line 71
def self.category
  :source_control
end
description() click to toggle source

@!group Documentation

# File pantograph/lib/pantograph/actions/push_git_tags.rb, line 29
def self.description
  "Push local tags to the remote - this will only push tags"
end
details() click to toggle source
# File pantograph/lib/pantograph/actions/push_git_tags.rb, line 57
def self.details
  "If you only want to push the tags and nothing else, you can use the `push_git_tags` action"
end
example_code() click to toggle source
# File pantograph/lib/pantograph/actions/push_git_tags.rb, line 65
def self.example_code
  [
    'push_git_tags'
  ]
end
is_supported?(platform) click to toggle source
# File pantograph/lib/pantograph/actions/push_git_tags.rb, line 61
def self.is_supported?(platform)
  true
end
run(params) click to toggle source
# File pantograph/lib/pantograph/actions/push_git_tags.rb, line 4
def self.run(params)
  command = [
    'git',
    'push',
    params[:remote]
  ]

  if params[:tag]
    command << "refs/tags/#{params[:tag]}"
  else
    command << '--tags'
  end

  # optionally add the force component
  command << '--force' if params[:force]

  result = Actions.sh(command.join(' '))
  UI.success('Tags pushed to remote')
  result
end