Sha256: d42d3b4380ebde94582b9aad672786f1f9315b626a396023fff2067e2ea1fc5f

Contents?: true

Size: 1.34 KB

Versions: 5

Compression:

Stored size: 1.34 KB

Contents

module Fastlane
  module Actions
    # Adds a git tag to the current commit
    class AddGitTagAction < Action
      def self.run(params)
        params = params.first

        specified_tag = (params && params[:tag])
        grouping      = (params && params[:grouping]) || 'builds'
        prefix        = (params && params[:prefix]) || ''
        build_number  = (params && params[:build_number]) || Actions.lane_context[Actions::SharedValues::BUILD_NUMBER]
        
        lane_name     = Actions.lane_context[Actions::SharedValues::LANE_NAME]

        tag = specified_tag || "#{grouping}/#{lane_name}/#{prefix}#{build_number}"

        Helper.log.info 'Adding git tag "#{tag}" 🎯.'
        Actions.sh("git tag #{tag}")
      end

      def self.description
        "This will add a git tag to the current branch"
      end

      def self.available_options
        [
          ['tag', 'Define your own tag text. This will replace all other parameters.'],
          ['grouping', 'Is used to keep your tags organised under one "folder". Defaults to "builds"'],
          ['prefix', 'Anything you want to put in front of the version number (e.g. "v").'],
          ['build_number', 'The build number. Defaults to the result of increment_build_number if you\'re using it']
        ]
      end

      def self.author
        "lmirosevic"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fastlane-0.10.0 lib/fastlane/actions/add_git_tag.rb
fastlane-0.9.0 lib/fastlane/actions/add_git_tag.rb
fastlane-0.8.1 lib/fastlane/actions/add_git_tag.rb
fastlane-0.8.0 lib/fastlane/actions/add_git_tag.rb
fastlane-0.7.0 lib/fastlane/actions/add_git_tag.rb