Class: Fastlane::Actions::UploadOssAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/android_unpack/actions/upload_oss.rb

Class Method Summary collapse

Class Method Details

.authorsObject



79
80
81
82
# File 'lib/fastlane/plugin/android_unpack/actions/upload_oss.rb', line 79

def self.authors
  # So no one will ever forget your contribution to fastlane :) You are awesome btw!
  ["Your GitHub/Twitter Name"]
end

.available_optionsObject



32
33
34
35
36
37
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
# File 'lib/fastlane/plugin/android_unpack/actions/upload_oss.rb', line 32

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :endpoint,
                            env_name: "UPLOAD_OSS_URL", # The name of the environment variable
                            description: "url", # a short description of this parameter
                            is_string: true,
                            default_value: 'http://oss-cn-hangzhou.aliyuncs.com'),
    FastlaneCore::ConfigItem.new(key: :bucket,
                            env_name: "UPLOAD_OSS_URL", # The name of the environment variable
                            description: "bucket", # a short description of this parameter
                            is_string: true,
                            default_value: ''),
    FastlaneCore::ConfigItem.new(key: :access_key_secret,
                            env_name: "UPLOAD_OSS_URL", # The name of the environment variable
                            description: "access_key_secret", # a short description of this parameter
                            is_string: true,
                            default_value: ''),
    FastlaneCore::ConfigItem.new(key: :access_key_secret,
                              env_name: "UPLOAD_OSS_URL", # The name of the environment variable
                              description: "access_key_secret", # a short description of this parameter
                              is_string: true,
                              default_value: ''),
    FastlaneCore::ConfigItem.new(key: :remote_path,
                            env_name: "UPLOAD_OSS_URL", # The name of the environment variable
                            escription: "url", # a short description of this parameter
                            is_string: true,
                            default_value: 'app.apk'),
    FastlaneCore::ConfigItem.new(key: :file_path,
                            env_name: "UPLOAD_OSS_FILE",
                            description: "file",
                            is_string: true, # true: verifies the input is a string, false: every kind of value
                            default_value: 'app-release.apk'), # the default value if the user didn't provide one
  ]
end

.descriptionObject



22
23
24
# File 'lib/fastlane/plugin/android_unpack/actions/upload_oss.rb', line 22

def self.description
  "A short description with <= 80 characters of what this action does"
end

.detailsObject



26
27
28
29
30
# File 'lib/fastlane/plugin/android_unpack/actions/upload_oss.rb', line 26

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) ⇒ Boolean

Returns:

  • (Boolean)


84
85
86
87
88
89
90
91
92
93
94
# File 'lib/fastlane/plugin/android_unpack/actions/upload_oss.rb', line 84

def self.is_supported?(platform)
  # you can do things like
  #
  #  true
  #
  #  platform == :ios
  #
  #  [:ios, :mac].include?(platform)
  #
  true
end

.outputObject



67
68
69
70
71
72
73
# File 'lib/fastlane/plugin/android_unpack/actions/upload_oss.rb', line 67

def self.output
  # Define the shared values you are going to provide
  # Example
  [
    ['UPLOAD_ANDROID_CUSTOM_VALUE', 'A description of what this value contains']
  ]
end

.return_valueObject



75
76
77
# File 'lib/fastlane/plugin/android_unpack/actions/upload_oss.rb', line 75

def self.return_value
  # If you method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fastlane/plugin/android_unpack/actions/upload_oss.rb', line 10

def self.run(params)
  # fastlane will take care of reading in the parameter and fetching the environment variable:
  client = Aliyun::OSS::Client.new(
    endpoint: params[:endpoint],
          access_key_id: params[:access_key_id],
          access_key_secret: params[:access_key_secret]
  )
  bucket = client.get_bucket(params[:bucket])
  bucket.put_object(params[:remote_path], file: params[:file_path])
  UI.message("upload done!")
end