class Fastlane::Actions::IncrementVersionAndTagAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/increment_version_and_tag.rb, line 65
def self.authors
  # So no one will ever forget your contribution to fastlane :) You are awesome btw!
  ["Your GitHub/Twitter Name"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/increment_version_and_tag.rb, line 38
def self.available_options
  # Define all options your action supports.

  # Below a few examples
  [
    FastlaneCore::ConfigItem.new(key: :version_pattern,
                                 env_name: "version_pattern", # The name of the repository
                                 description: "The version pattern (regexp)", # a short description of this parameter
                                 default_value: "v[0-9]*\.[0-9]*\.[0-9]*",
                                 optional: true)

  ]
end
description() click to toggle source

@!group Documentation

# File lib/fastlane/plugin/elux_actions/actions/increment_version_and_tag.rb, line 28
def self.description
  "Increment the version by looking for latest version tag"
end
details() click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/increment_version_and_tag.rb, line 32
def self.details
  # Optional:
  # this is your chance to provide a more detailed description of this action
  "The details here"
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/increment_version_and_tag.rb, line 70
def self.is_supported?(platform)
  # you can do things like
  #
  #  true
  #
  #  platform == :ios
  #
  #  [:ios, :mac].include?(platform)
  #

  platform == :ios
end
output() click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/increment_version_and_tag.rb, line 52
def self.output
  # Define the shared values you are going to provide
  # Example
  [
    ['NEW_VERSION', 'The new version'],
    ['NEW_VERSION_NUMBERS', 'The new version, only numbers and periods']
  ]
end
return_value() click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/increment_version_and_tag.rb, line 61
def self.return_value
  # If you method provides a return value, you can describe here what it does
end
run(params) click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/increment_version_and_tag.rb, line 9
def self.run(params)
  # Get next version number
  cmd = "git tag --sort=v:refname | grep \"#{params[:version_pattern]}\"  | tail -1  | awk -F. '{printf(\"%s.%s.0\", $1, $2+1)}'"
  STDOUT.puts cmd
  STDOUT.flush
  version = `#{cmd}`
  Actions.lane_context[SharedValues::NEW_VERSION] = version
  Actions.lane_context[SharedValues::NEW_VERSION_NUMBERS] = version.gsub(/[a-zA-Z]/, '')

  # Create the tag
  cmd = "git tag -a \"#{version}\" -m \"Version #{version}\""
  STDOUT.puts cmd
  STDOUT.flush
end