class Fastlane::Actions::NexusPromoteAction
Public Class Methods
available_options()
click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/nexus_promote_action.rb, line 56 def self.available_options # Define all options your action supports. # Below a few examples [ FastlaneCore::ConfigItem.new( key: :release_repo, env_name: "release_repo", description: "Target release repo", verify_block: proc do |value| UI.user_error!("Please provide nexus_base_url") unless value and !value.empty? end ), FastlaneCore::ConfigItem.new( key: :nexus_base_url, env_name: "nexus_base_url", description: "The URL base address to nexus. Example https://localhost:8080", verify_block: proc do |value| UI.user_error!("Please provide nexus_base_url") unless value and !value.empty? end ), FastlaneCore::ConfigItem.new( key: :staging_repo, env_name: "staging_repo", description: "The staging repo to fetch artifact from", verify_block: proc do |value| UI.user_error!("Please provide staging_repo") unless value and !value.empty? end ), FastlaneCore::ConfigItem.new( key: :artifact_id, env_name: "artifact_id", description: "The artifact_id to use", verify_block: proc do |value| UI.user_error!("Please provide artifact_id") unless value and !value.empty? end ), FastlaneCore::ConfigItem.new( key: :group_id, env_name: "group_id", description: "The group_id to use", verify_block: proc do |value| UI.user_error!("Please provide group_id") unless value and !value.empty? end ), FastlaneCore::ConfigItem.new( key: :nexus_user, env_name: "nexus_user", description: "The username in nexus", verify_block: proc do |value| UI.user_error!("Please provide group_id") unless value and !value.empty? end ), FastlaneCore::ConfigItem.new( key: :nexus_password, env_name: "nexus_password", description: "The password in nexus", verify_block: proc do |value| UI.user_error!("Please provide group_id") unless value and !value.empty? end ), FastlaneCore::ConfigItem.new( key: :classifier, env_name: "classifier", description: "The classifier of the artifact", default_value: "", optional: true ), FastlaneCore::ConfigItem.new( key: :types, env_name: "types", description: "The artifact types", is_string: false, default_value: ["jar", "pom"], optional: true ), FastlaneCore::ConfigItem.new( key: :version, env_name: "version", description: "The version to promote", is_string: true, optional: true ) ] end
description()
click to toggle source
@!group Documentation
# File lib/fastlane/plugin/elux_actions/actions/nexus_promote_action.rb, line 46 def self.description "A short description with <= 80 characters of what this action does" end
details()
click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/nexus_promote_action.rb, line 50 def self.details # Optional: # this is your chance to provide a more detailed description of this action "You can use this action to do cool things..." end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/nexus_promote_action.rb, line 159 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/nexus_promote_action.rb, line 142 def self.output # Define the shared values you are going to provide # Example [ ['RELEASE_TO_NEXUS_CUSTOM_VALUE', 'A description of what this value contains'] ] end
return_value()
click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/nexus_promote_action.rb, line 150 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/nexus_promote_action.rb, line 12 def self.run(params) # fastlane will take care of reading in the parameter and fetching the environment variable: version = params[:version] version ||= Actions.sh "echo `git describe --tags | sed s/v//g`" version = version.rstrip classifier_str = "-#{params[:classifier]}" unless params[:classifier].empty? path = params[:group_id].gsub(".", "/") ENV['FASTLANE_NEXUS_PASSWORD'] = params[:nexus_password] actions = [] params[:types].each do |type| actions << "wget -P /tmp #{params[:nexus_base_url]}/repository/#{params[:staging_repo]}/#{path}/#{params[:artifact_id]}/#{version}/#{params[:artifact_id]}-#{version}#{classifier_str}.#{type}" actions << "wget -P /tmp #{params[:nexus_base_url]}/repository/#{params[:staging_repo]}/#{path}/#{params[:artifact_id]}/#{version}/#{params[:artifact_id]}-#{version}#{classifier_str}.#{type}.md5" actions << "wget -P /tmp #{params[:nexus_base_url]}/repository/#{params[:staging_repo]}/#{path}/#{params[:artifact_id]}/#{version}/#{params[:artifact_id]}-#{version}#{classifier_str}.#{type}.sha1" actions << "curl --fail -u \"" + params[:nexus_user] + ":$FASTLANE_NEXUS_PASSWORD\" --upload-file /tmp/#{params[:artifact_id]}-#{version}#{classifier_str}.#{type} #{params[:nexus_base_url]}/repository/#{params[:release_repo]}/#{path}/#{params[:artifact_id]}/#{version}/#{params[:artifact_id]}-#{version}#{classifier_str}.#{type} #{verbose}" actions << "curl --fail -u \"" + params[:nexus_user] + ":$FASTLANE_NEXUS_PASSWORD\" --upload-file /tmp/#{params[:artifact_id]}-#{version}#{classifier_str}.#{type}.md5 #{params[:nexus_base_url]}/repository/#{params[:release_repo]}/#{path}/#{params[:artifact_id]}/#{version}/#{params[:artifact_id]}-#{version}#{classifier_str}.#{type}.md5 #{verbose}" actions << "curl --fail -u \"" + params[:nexus_user] + ":$FASTLANE_NEXUS_PASSWORD\" --upload-file /tmp/#{params[:artifact_id]}-#{version}#{classifier_str}.#{type}.sha1 #{params[:nexus_base_url]}/repository/#{params[:release_repo]}/#{path}/#{params[:artifact_id]}/#{version}/#{params[:artifact_id]}-#{version}#{classifier_str}.#{type}.sha1 #{verbose}" end command = actions.map(&:rstrip).join(' && ') Actions.sh(command) end
verbose()
click to toggle source
# File lib/fastlane/plugin/elux_actions/actions/nexus_promote_action.rb, line 8 def self.verbose "-v" if FastlaneCore::Globals.verbose? end