Class: Fastlane::Actions::RemoveGitTagAction

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

Overview

Adds a git tag to the current commit

Class Method Summary collapse

Class Method Details

.authorsObject



55
56
57
# File 'lib/fastlane/plugin/remove_git_tag/actions/remove_git_tag_action.rb', line 55

def self.authors
    ["Marker Digital"]
end

.available_optionsObject



36
37
38
39
40
41
42
43
# File 'lib/fastlane/plugin/remove_git_tag/actions/remove_git_tag_action.rb', line 36

def self.available_options
    [
        FastlaneCore::ConfigItem.new(key: :tag,
                                     env_name: "FL_GIT_TAG_TAG",
                                     description: "Define your own tag text. This will replace all other parameters",
                                     optional: true)
    ]
end

.categoryObject



51
52
53
# File 'lib/fastlane/plugin/remove_git_tag/actions/remove_git_tag_action.rb', line 51

def self.category
    :source_control
end

.descriptionObject



25
26
27
# File 'lib/fastlane/plugin/remove_git_tag/actions/remove_git_tag_action.rb', line 25

def self.description
    "This will remove a tag from the remote repository"
end

.detailsObject



29
30
31
32
33
34
# File 'lib/fastlane/plugin/remove_git_tag/actions/remove_git_tag_action.rb', line 29

def self.details
    [
        "This will automatically remove a tag from the remote repository, where:",
        "- `tag` is the tag name"
    ].join("\n")
end

.example_codeObject



45
46
47
48
49
# File 'lib/fastlane/plugin/remove_git_tag/actions/remove_git_tag_action.rb', line 45

def self.example_code
    [
        'remove_git_tag(tag: "Beta")'
    ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/fastlane/plugin/remove_git_tag/actions/remove_git_tag_action.rb', line 59

def self.is_supported?(platform)
    true
end

.run(options) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fastlane/plugin/remove_git_tag/actions/remove_git_tag_action.rb', line 9

def self.run(options)
    # lane name in lane_context could be nil because you can just call $fastlane add_git_tag which has no context
    lane_name = Actions.lane_context[Actions::SharedValues::LANE_NAME].to_s.delete(' ') # no spaces allowed

    tag = options[:tag]
    cmd = ["git tag -d #{tag.shellescape}"]

    UI.message("Removing remote git tag '#{tag}' 🎯.")
    Actions.sh(cmd.join(' '))

    cmd = ["git push origin :refs/tags/#{tag.shellescape}"]

    UI.message("Removing remote git tag '#{tag}' 🎯.")
    Actions.sh(cmd.join(' '))
end