fastlane-craft 1.3.10 → 1.3.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4ee1f002c4fc33225f5a3802ac7e05ef7cf5fd7c669abff46fcf8e2d13da575
4
- data.tar.gz: b8d13d64c29c8795c4b66237eb88c8426d961451ab95f5631f31cd445406f200
3
+ metadata.gz: f4e2b53b30d3520820370a758e5bf8a0df45f47bfb7b50e1eae1e3ee9e08f474
4
+ data.tar.gz: aa76d60dcfc0c865e18ce65a466bf1e20038307bf66f160a3cf670900e9a1f8d
5
5
  SHA512:
6
- metadata.gz: 7fdec4d4675fe54be0ec81c7b2381504a89eaca9d18fdece8d655045d1fd3894a427f669b6850b40f555cd1d45abf880ba3e103ae7c1c18f4ac83b3a8d1aad2d
7
- data.tar.gz: dcc77e31065227201e22579e3d4e3499a05fe9c2ac9a791cc0b15321af53aa54ce3b97a6bd9c0146b52b2f987350a138e7abbba8332e194b8d8bacd89517e06c
6
+ metadata.gz: a2ae3ecabe88204acdf6c5c85089b38f9eaa363e11db7c9edfae7bc795afa3730c070b2f293bc69e83ac408169222b5d9b04b48f8c4d5f766198db29e2a62a13
7
+ data.tar.gz: bdc045ebd130ee010712ddfeba2cff31238874938a10e93728cd582a695ecd4ad87f298e44d9ab1be1ccb2a61b0b40040a811b20d0958abed272b266db3468f2
@@ -2,6 +2,7 @@ require_relative 'fastlane-craft/version'
2
2
  require_relative 'fastlane-craft/telegram'
3
3
  require_relative 'fastlane-craft/app_release'
4
4
  require_relative 'fastlane-craft/upload_dsym'
5
+ require_relative 'fastlane-craft/upload_to_s3'
5
6
 
6
7
  module FastlaneCraft
7
8
  end
@@ -0,0 +1,136 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ UPLOADED_S3_URL = 'UPLOAD_S3_URL'.freeze
5
+ end
6
+
7
+ class UploadToS3Action < Action
8
+ def self.run(params)
9
+ require 'aws-sdk-s3'
10
+
11
+ local_path = params[:path]
12
+ local_name = File.basename(local_path, )
13
+
14
+ bucket = params[:space] || params[:bucket]
15
+ acl = params[:acl]
16
+ file_key = local_name
17
+ file_path = params[:space] ? params[:bucket] + '/' + file_key : file_key
18
+
19
+ client = Aws::S3::Client.new(
20
+ access_key_id: params[:access_key],
21
+ secret_access_key: params[:secret_access_key],
22
+ endpoint: params[:endpoint],
23
+ region: params[:region]
24
+ )
25
+
26
+ UI.message "Check whether destination bucket #{bucket} exists..💤"
27
+ begin
28
+ response = client.create_bucket({
29
+ bucket: bucket,
30
+ acl: 'private'
31
+ })
32
+ UI.message "✨ Bucket #{bucket} created! ✨"
33
+ rescue Aws::S3::Errors::BucketAlreadyExists
34
+ UI.message "Bucket #{bucket} alredy exists 👌"
35
+ end
36
+
37
+ UI.message "Going to upload file to s3..💤"
38
+ File.open(local_path, 'r') do |body|
39
+ response = client.put_object(
40
+ acl: acl,
41
+ bucket: bucket,
42
+ key: file_path,
43
+ body: body
44
+ )
45
+
46
+ s3_url = params[:endpoint] + "/" + bucket + "/" + file_path
47
+ ENV[SharedValues::UPLOADED_S3_URL] = s3_url
48
+
49
+ UI.message "✨ file uploaded to #{s3_url} ✨"
50
+ end
51
+ end
52
+
53
+ #####################################################
54
+ # @!group Documentation
55
+ #####################################################
56
+
57
+ def self.description
58
+ "Upload file to S3 or Spaces"
59
+ end
60
+
61
+ def self.available_options
62
+ [
63
+ FastlaneCore::ConfigItem.new(key: :path,
64
+ env_name: "FL_UPLOAD_S3_PATH",
65
+ description: "Upload local path",
66
+ is_string: true,
67
+ verify_block: proc do |value|
68
+ UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
69
+ end),
70
+ FastlaneCore::ConfigItem.new(key: :region,
71
+ env_name: "FL_UPLOAD_S3_REGION",
72
+ description: "Region for S3 or Spaces",
73
+ is_string: true,
74
+ default_value: 'ams3',
75
+ verify_block: proc do |value|
76
+ UI.user_error!("No region for UploadToS3Action given, pass using `region: 'region'`") unless (value and not value.empty?)
77
+ end),
78
+ FastlaneCore::ConfigItem.new(key: :endpoint,
79
+ env_name: "FL_UPLOAD_S3_ENDPOINT",
80
+ description: "Endpoint for S3 or Spaces",
81
+ is_string: true,
82
+ default_value: 'https://ams3.digitaloceanspaces.com',
83
+ verify_block: proc do |value|
84
+ UI.user_error!("No Endpoint for UploadToS3Action given, pass using `endpoint: 'endpoint'`") unless (value and not value.empty?)
85
+ end),
86
+ FastlaneCore::ConfigItem.new(key: :access_key,
87
+ env_name: "FL_UPLOAD_S3_ACCESS_KEY",
88
+ description: "Access Key for S3 or Spaces",
89
+ is_string: true,
90
+ verify_block: proc do |value|
91
+ raise "No Access Key for UploadToS3Action given, pass using `access_key: 'access_key'`".red unless (value and not value.empty?)
92
+ end),
93
+ FastlaneCore::ConfigItem.new(key: :secret_access_key,
94
+ env_name: "FL_UPLOAD_S3_SECRET_ACCESS_KEY",
95
+ description: "Secret Access Key for S3 or Spaces",
96
+ is_string: true,
97
+ verify_block: proc do |value|
98
+ raise "No Secret Access Key for UploadToS3Action given, pass using `secret_access_key: 'secret_access_key'`".red unless (value and not value.empty?)
99
+ end),
100
+ FastlaneCore::ConfigItem.new(key: :bucket,
101
+ env_name: "FL_UPLOAD_S3_BUCKET",
102
+ description: "Bucket for S3 or Spaces",
103
+ is_string: true,
104
+ verify_block: proc do |value|
105
+ raise "No Bucket for UploadToS3Action given, pass using `bucket: 'bucket'`".red unless (value and not value.empty?)
106
+ end),
107
+ FastlaneCore::ConfigItem.new(key: :space,
108
+ env_name: "FL_UPLOAD_S3_SPACE",
109
+ description: "Digital Ocean Space",
110
+ is_string: true,
111
+ default_value: 'appcraft-files'),
112
+ FastlaneCore::ConfigItem.new(key: :acl,
113
+ env_name: "FL_UPLOAD_S3_ACL",
114
+ description: "Access level for the file",
115
+ is_string: true,
116
+ default_value: "public-read",
117
+ verify_block: proc do |value|
118
+ raise "No Bucket for UploadToS3Action given, pass using `bucket: 'bucket'`".red unless (value and not value.empty?)
119
+ end),
120
+ ]
121
+ end
122
+
123
+ def self.authors
124
+ ["https://github.com/sroik", "https://github.com/elfenlaid"]
125
+ end
126
+
127
+ def self.output
128
+ ['UPLOADED_S3_URL': 'Uploaded file s3 path']
129
+ end
130
+
131
+ def self.is_supported?(platform)
132
+ platform == :android || platform == :ios
133
+ end
134
+ end
135
+ end
136
+ end
@@ -1,3 +1,3 @@
1
1
  module FastlaneCraft
2
- VERSION = '1.3.10'.freeze
2
+ VERSION = '1.3.11'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-craft
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.10
4
+ version: 1.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - sroik
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-11-27 00:00:00.000000000 Z
12
+ date: 2018-11-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fastlane
@@ -136,6 +136,7 @@ files:
136
136
  - lib/fastlane-craft/telegram.rb
137
137
  - lib/fastlane-craft/telegram_notifier.rb
138
138
  - lib/fastlane-craft/upload_dsym.rb
139
+ - lib/fastlane-craft/upload_to_s3.rb
139
140
  - lib/fastlane-craft/version.rb
140
141
  homepage: https://github.com/app-craft/fastlane-craft.git
141
142
  licenses: