Class: Fastlane::Actions::AddGitTagAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::AddGitTagAction
- Defined in:
- lib/fastlane/actions/add_git_tag.rb
Overview
Adds a git tag to the current commit
Constant Summary
Constants inherited from Fastlane::Action
Fastlane::Action::AVAILABLE_CATEGORIES
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .run(options) ⇒ Object
Methods inherited from Fastlane::Action
action_name, author, lane_context, method_missing, other_action, output, return_value, sample_return_value, sh, step_text
Class Method Details
.authors ⇒ Object
93 94 95 |
# File 'lib/fastlane/actions/add_git_tag.rb', line 93 def self. ["lmirosevic", "maschall"] end |
.available_options ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/fastlane/actions/add_git_tag.rb', line 38 def self. [ 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), FastlaneCore::ConfigItem.new(key: :grouping, env_name: "FL_GIT_TAG_GROUPING", description: "Is used to keep your tags organised under one 'folder'. Defaults to 'builds'", default_value: 'builds'), FastlaneCore::ConfigItem.new(key: :prefix, env_name: "FL_GIT_TAG_PREFIX", description: "Anything you want to put in front of the version number (e.g. 'v')", default_value: ''), FastlaneCore::ConfigItem.new(key: :build_number, env_name: "FL_GIT_TAG_BUILD_NUMBER", description: "The build number. Defaults to the result of increment_build_number if you\'re using it", default_value: Actions.lane_context[Actions::SharedValues::BUILD_NUMBER], is_string: false), FastlaneCore::ConfigItem.new(key: :message, env_name: "FL_GIT_TAG_MESSAGE", description: "The tag message. Defaults to the tag's name", optional: true), FastlaneCore::ConfigItem.new(key: :commit, env_name: "FL_GIT_TAG_COMMIT", description: "The commit or object where the tag will be set. Defaults to the current HEAD", optional: true), FastlaneCore::ConfigItem.new(key: :force, env_name: "FL_GIT_TAG_FORCE", description: "Force adding the tag", optional: true, is_string: false, default_value: false) ] end |
.category ⇒ Object
89 90 91 |
# File 'lib/fastlane/actions/add_git_tag.rb', line 89 def self.category :source_control end |
.description ⇒ Object
22 23 24 |
# File 'lib/fastlane/actions/add_git_tag.rb', line 22 def self.description "This will add an annotated git tag to the current branch" end |
.details ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/fastlane/actions/add_git_tag.rb', line 26 def self.details [ "This will automatically tag your build with the following format: `<grouping>/<lane>/<prefix><build_number>`, where:", "- `grouping` is just to keep your tags organised under one 'folder', defaults to 'builds'", "- `lane` is the name of the current fastlane lane", "- `prefix` is anything you want to stick in front of the version number, e.g. 'v'", "- `build_number` is the build number, which defaults to the value emitted by the `increment_build_number` action", "", "For example for build 1234 in the 'appstore' lane it will tag the commit with `builds/appstore/1234`" ].join("\n") end |
.example_code ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/fastlane/actions/add_git_tag.rb', line 74 def self.example_code [ 'add_git_tag # simple tag with default values', 'add_git_tag( grouping: "fastlane-builds", prefix: "v", build_number: 123 )', '# Alternatively, you can specify your own tag. Note that if you do specify a tag, all other arguments are ignored. add_git_tag( tag: "my_custom_tag" )' ] end |
.is_supported?(platform) ⇒ Boolean
97 98 99 |
# File 'lib/fastlane/actions/add_git_tag.rb', line 97 def self.is_supported?(platform) true end |
.run(options) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/fastlane/actions/add_git_tag.rb', line 5 def self.run() lane_name = Actions.lane_context[Actions::SharedValues::LANE_NAME].delete(' ') # no spaces allowed tag = [:tag] || "#{[:grouping]}/#{lane_name}/#{[:prefix]}#{[:build_number]}" = [:message] || "#{tag} (fastlane)" cmd = ['git tag'] cmd << ["-am #{.shellescape}"] cmd << '--force' if [:force] cmd << "'#{tag}'" cmd << [:commit].to_s if [:commit] UI. "Adding git tag '#{tag}' 🎯." Actions.sh(cmd.join(' ')) end |