Class: Fastlane::Actions::IosClearIntermediateTagsAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_clear_intermediate_tags.rb

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



63
64
65
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_clear_intermediate_tags.rb', line 63

def self.authors
  ['Automattic']
end

.available_optionsObject



38
39
40
41
42
43
44
45
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_clear_intermediate_tags.rb', line 38

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :version,
                                 env_name: 'FL_IOS_CLEAN_INTERMEDIATE_TAGS_VERSION',
                                 description: 'The version of the tags to clear',
                                 type: String),
  ]
end

.categoryObject



53
54
55
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_clear_intermediate_tags.rb', line 53

def self.category
  :deprecated
end

.deprecated_notesObject



57
58
59
60
61
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_clear_intermediate_tags.rb', line 57

def self.deprecated_notes
  "This action is deprecated as we don't believe it's currently in use in our projects.
  However, just to be sure that it's not in use, we decided to deprecate it first. If you
  believe that this is a mistake, please let us know on Slack."
end

.descriptionObject



30
31
32
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_clear_intermediate_tags.rb', line 30

def self.description
  '(DEPRECATED) Cleans all the intermediate tags for the given version'
end

.detailsObject



34
35
36
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_clear_intermediate_tags.rb', line 34

def self.details
  '(DEPRECATED) Cleans all the intermediate tags for the given version'
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_clear_intermediate_tags.rb', line 67

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

.outputObject



47
48
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_clear_intermediate_tags.rb', line 47

def self.output
end

.return_valueObject



50
51
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_clear_intermediate_tags.rb', line 50

def self.return_value
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_clear_intermediate_tags.rb', line 4

def self.run(params)
  return unless UI.confirm("#{deprecated_notes} Would you like to continue with the action?")

  UI.message("Deleting tags for version: #{params[:version]}")

  require_relative '../../helper/git_helper'

  # Download all the remote tags prior to starting – that way we don't miss any on the server
  Fastlane::Helper::GitHelper.fetch_all_tags

  # Delete 4-parts version names starting with our version number
  parts = params[:version].split('.')
  pattern = parts.fill('*', parts.length...4).join('.') # "1.2.*.*" or "1.2.3.*"

  intermediate_tags = Fastlane::Helper::GitHelper.list_local_tags(matching: pattern)
  tag_count = intermediate_tags.count

  return unless tag_count.positive? && UI.confirm("Are you sure you want to delete #{tag_count} tags?")

  Fastlane::Helper::GitHelper.delete_tags(intermediate_tags, delete_on_remote: true)
end