Method: Fastlane::FastFile#get_tags

Defined in:
fastlane/lib/fastlane/fast_file.rb

#get_tags(folder: nil, remote: false) ⇒ Object



413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
# File 'fastlane/lib/fastlane/fast_file.rb', line 413

def get_tags(folder: nil, remote: false)
  if remote
    UI.message("Fetching remote git tags...")
    Helper.with_env_values('GIT_TERMINAL_PROMPT' => '0') do
      Actions.sh("cd #{folder.shellescape} && git fetch --all --tags -q")
    end
  end

  # Fetch all possible tags
  git_tags_string = Actions.sh("cd #{folder.shellescape} && git tag -l")
  git_tags = git_tags_string.split("\n")

  # Sort tags based on their version number
  return git_tags
         .select { |tag| FastlaneCore::TagVersion.correct?(tag) }
         .sort_by { |tag| FastlaneCore::TagVersion.new(tag) }
end