fastlane-plugin-aws_s3 1.8.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/aws_s3/actions/aws_s3_action.rb +136 -39
- data/lib/fastlane/plugin/aws_s3/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa270593b8070859b409a3123921341f44e46a750aadd42df7c958c3946529b5
|
4
|
+
data.tar.gz: 3e37babdac81f10057af2d113423351332fcfe34406b78dd7ffce249ac9bbfd3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 944b7f4fda0f8963f5896f4edcb973bbd6d8ef2a3931268455404fcd3696897339f3daa6c810b8a3d3a4e2ef35ee909f6b5441547b7a06d26439946b62131a4d
|
7
|
+
data.tar.gz: 537580be8d808a2458ca5df1209406b8b01ba1855e30ded8d10c42897e79f791fa18389cff8d15e3cadcf486c034160421fc61dda7b86f5c5d6ad0459eb2927b
|
@@ -35,6 +35,8 @@ module Fastlane
|
|
35
35
|
params[:aws_profile] = config[:aws_profile]
|
36
36
|
params[:bucket] = config[:bucket]
|
37
37
|
params[:endpoint] = config[:endpoint]
|
38
|
+
params[:download_endpoint] = config[:download_endpoint]
|
39
|
+
params[:download_endpoint_replacement_regex] = config[:download_endpoint_replacement_regex]
|
38
40
|
params[:region] = config[:region]
|
39
41
|
params[:app_directory] = config[:app_directory]
|
40
42
|
params[:acl] = config[:acl]
|
@@ -49,6 +51,9 @@ module Fastlane
|
|
49
51
|
params[:html_file_name] = config[:html_file_name]
|
50
52
|
params[:skip_html_upload] = config[:skip_html_upload]
|
51
53
|
params[:html_in_folder] = config[:html_in_folder]
|
54
|
+
params[:html_in_root] = config[:html_in_root]
|
55
|
+
params[:version_in_folder] = config[:version_in_folder]
|
56
|
+
params[:version_in_root] = config[:version_in_root]
|
52
57
|
params[:version_template_path] = config[:version_template_path]
|
53
58
|
params[:version_file_name] = config[:version_file_name]
|
54
59
|
params[:version_template_params] = config[:version_template_params]
|
@@ -79,25 +84,14 @@ module Fastlane
|
|
79
84
|
UI.user_error!("Please only give IPA path or APK path (not both)") if ipa_file.to_s.length > 0 && apk_file.to_s.length > 0
|
80
85
|
|
81
86
|
require 'aws-sdk-s3'
|
82
|
-
if s3_profile
|
83
|
-
creds = Aws::SharedCredentials.new(profile_name: s3_profile);
|
84
|
-
elsif s3_access_key.to_s.length > 0 && s3_secret_access_key.to_s.length > 0
|
85
|
-
creds = Aws::Credentials.new(s3_access_key, s3_secret_access_key)
|
86
|
-
else
|
87
|
-
UI.important("No S3 access key or S3 secret access key given, using S3 instance profile by default.")
|
88
|
-
UI.important("If you want to use specific creds to S3 access, you can pass using `access_key: 'key'` and `secret_access_key: 'secret key'` (or use `aws_profile: 'profile'`)")
|
89
|
-
creds = Aws::InstanceProfileCredentials.new()
|
90
|
-
end
|
91
|
-
Aws.config.update({
|
92
|
-
region: s3_region,
|
93
|
-
credentials: creds
|
94
|
-
})
|
95
87
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
88
|
+
client_cfg = {}
|
89
|
+
client_cfg[:region] = s3_region if s3_region
|
90
|
+
client_cfg[:endpoint] = s3_endpoint if s3_endpoint
|
91
|
+
client_cfg[:profile] = s3_profile if s3_profile
|
92
|
+
client_cfg[:credentials] = Aws::Credentials.new(s3_access_key, s3_secret_access_key) if s3_access_key && s3_secret_access_key
|
93
|
+
|
94
|
+
s3_client = Aws::S3::Client.new(client_cfg)
|
101
95
|
|
102
96
|
if xcarchive_file.nil?
|
103
97
|
xcarchive_file = Actions.lane_context[SharedValues::XCODEBUILD_ARCHIVE]
|
@@ -124,18 +118,22 @@ module Fastlane
|
|
124
118
|
html_template_params = params[:html_template_params] || {}
|
125
119
|
html_file_name = params[:html_file_name]
|
126
120
|
generate_html_in_folder = params[:html_in_folder]
|
121
|
+
generate_html_in_root = params[:html_in_root]
|
122
|
+
generate_version_in_folder = params[:version_in_folder]
|
123
|
+
generate_version_in_root = params[:version_in_root]
|
127
124
|
version_template_path = params[:version_template_path]
|
128
125
|
version_template_params = params[:version_template_params] || {}
|
129
126
|
version_file_name = params[:version_file_name]
|
130
127
|
override_file_name = params[:override_file_name]
|
131
|
-
|
128
|
+
download_endpoint = params[:download_endpoint]
|
129
|
+
download_endpoint_replacement_regex = params[:download_endpoint_replacement_regex]
|
132
130
|
url_part = self.expand_path_with_substitutions_from_ipa_plist(ipa_file, s3_path)
|
133
131
|
|
134
132
|
ipa_file_basename = File.basename(ipa_file)
|
135
133
|
ipa_file_name = "#{url_part}#{override_file_name ? override_file_name : ipa_file_basename}"
|
136
134
|
ipa_file_data = File.open(ipa_file, 'rb')
|
137
135
|
|
138
|
-
ipa_url = self.upload_file(s3_client, s3_bucket, app_directory, ipa_file_name, ipa_file_data, acl, server_side_encryption)
|
136
|
+
ipa_url = self.upload_file(s3_client, s3_bucket, app_directory, ipa_file_name, ipa_file_data, acl, server_side_encryption, download_endpoint, download_endpoint_replacement_regex)
|
139
137
|
|
140
138
|
# Setting action and environment variables
|
141
139
|
Actions.lane_context[SharedValues::S3_IPA_OUTPUT_PATH] = ipa_url
|
@@ -146,7 +144,7 @@ module Fastlane
|
|
146
144
|
dsym_file_name = "#{url_part}#{dsym_file_basename}"
|
147
145
|
dsym_file_data = File.open(dsym_file, 'rb')
|
148
146
|
|
149
|
-
dsym_url = self.upload_file(s3_client, s3_bucket, app_directory, dsym_file_name, dsym_file_data, acl, server_side_encryption)
|
147
|
+
dsym_url = self.upload_file(s3_client, s3_bucket, app_directory, dsym_file_name, dsym_file_data, acl, server_side_encryption, download_endpoint, download_endpoint_replacement_regex)
|
150
148
|
|
151
149
|
# Setting action and environment variables
|
152
150
|
Actions.lane_context[SharedValues::S3_DSYM_OUTPUT_PATH] = dsym_url
|
@@ -207,7 +205,7 @@ module Fastlane
|
|
207
205
|
# plist uploading
|
208
206
|
#
|
209
207
|
#####################################
|
210
|
-
plist_url = self.upload_file(s3_client, s3_bucket, app_directory, plist_file_name, plist_render, acl, server_side_encryption)
|
208
|
+
plist_url = self.upload_file(s3_client, s3_bucket, app_directory, plist_file_name, plist_render, acl, server_side_encryption, download_endpoint, download_endpoint_replacement_regex)
|
211
209
|
|
212
210
|
# Creates html from template
|
213
211
|
if html_template_path && File.exist?(html_template_path)
|
@@ -249,9 +247,34 @@ module Fastlane
|
|
249
247
|
#####################################
|
250
248
|
|
251
249
|
skip_html = params[:skip_html_upload]
|
252
|
-
|
253
|
-
|
254
|
-
|
250
|
+
|
251
|
+
html_file_names = []
|
252
|
+
version_file_names = []
|
253
|
+
|
254
|
+
unless skip_html
|
255
|
+
if generate_html_in_root
|
256
|
+
html_file_names << html_file_name
|
257
|
+
end
|
258
|
+
if generate_html_in_folder
|
259
|
+
html_file_names << "#{url_part}#{html_file_name}"
|
260
|
+
end
|
261
|
+
end
|
262
|
+
if generate_version_in_root
|
263
|
+
version_file_names << version_file_name
|
264
|
+
end
|
265
|
+
if generate_version_in_folder
|
266
|
+
version_file_names << "#{url_part}#{version_file_name}"
|
267
|
+
end
|
268
|
+
|
269
|
+
html_url = nil
|
270
|
+
version_url = nil
|
271
|
+
|
272
|
+
html_file_names.each do |html_file_name|
|
273
|
+
html_url = self.upload_file(s3_client, s3_bucket, app_directory, html_file_name, html_render, acl, server_side_encryption, download_endpoint, download_endpoint_replacement_regex)
|
274
|
+
end
|
275
|
+
version_file_names.each do |version_file_name|
|
276
|
+
version_url = self.upload_file(s3_client, s3_bucket, app_directory, version_file_name, version_render, acl, server_side_encryption, download_endpoint, download_endpoint_replacement_regex)
|
277
|
+
end
|
255
278
|
|
256
279
|
# Setting action and environment variables
|
257
280
|
Actions.lane_context[SharedValues::S3_PLIST_OUTPUT_PATH] = plist_url
|
@@ -283,8 +306,10 @@ module Fastlane
|
|
283
306
|
sh("zip -r '#{archive_zip}' '#{archive}'")
|
284
307
|
full_archive_zip_name = "#{url_part}#{archive_zip_name}"
|
285
308
|
archive_zip_data = File.open(archive_zip, 'rb')
|
309
|
+
download_endpoint = params[:download_endpoint]
|
310
|
+
download_endpoint_replacement_regex = params[:download_endpoint_replacement_regex]
|
286
311
|
|
287
|
-
archive_url = self.upload_file(s3_client, s3_bucket, app_directory, full_archive_zip_name, archive_zip_data, acl, server_side_encryption)
|
312
|
+
archive_url = self.upload_file(s3_client, s3_bucket, app_directory, full_archive_zip_name, archive_zip_data, acl, server_side_encryption, download_endpoint, download_endpoint_replacement_regex)
|
288
313
|
|
289
314
|
Actions.lane_context[SharedValues::S3_XCARCHIVE_OUTPUT_PATH] = archive_url
|
290
315
|
ENV[SharedValues::S3_XCARCHIVE_OUTPUT_PATH.to_s] = archive_url
|
@@ -299,7 +324,7 @@ module Fastlane
|
|
299
324
|
version_name = version[1]
|
300
325
|
title = version[2]
|
301
326
|
|
302
|
-
s3_path = "
|
327
|
+
s3_path = "v{version_name}_b{version_code}/" unless s3_path
|
303
328
|
|
304
329
|
app_directory = params[:app_directory]
|
305
330
|
|
@@ -307,18 +332,23 @@ module Fastlane
|
|
307
332
|
html_template_params = params[:html_template_params] || {}
|
308
333
|
html_file_name = params[:html_file_name]
|
309
334
|
generate_html_in_folder = params[:html_in_folder]
|
335
|
+
generate_html_in_root = params[:html_in_root]
|
336
|
+
generate_version_in_folder = params[:version_in_folder]
|
337
|
+
generate_version_in_root = params[:version_in_root]
|
310
338
|
version_template_path = params[:version_template_path]
|
311
339
|
version_template_params = params[:version_template_params] || {}
|
312
340
|
version_file_name = params[:version_file_name]
|
313
341
|
override_file_name = params[:override_file_name]
|
342
|
+
download_endpoint = params[:download_endpoint]
|
343
|
+
download_endpoint_replacement_regex = params[:download_endpoint_replacement_regex]
|
314
344
|
|
315
|
-
url_part = s3_path
|
345
|
+
url_part = self.expand_path_with_substitutions_with_versions(version_code, version_name, s3_path)
|
316
346
|
|
317
347
|
apk_file_basename = File.basename(apk_file)
|
318
348
|
apk_file_name = "#{url_part}#{override_file_name ? override_file_name : apk_file_basename}"
|
319
349
|
apk_file_data = File.open(apk_file, 'rb')
|
320
350
|
|
321
|
-
apk_url = self.upload_file(s3_client, s3_bucket, app_directory, apk_file_name, apk_file_data, acl, server_side_encryption)
|
351
|
+
apk_url = self.upload_file(s3_client, s3_bucket, app_directory, apk_file_name, apk_file_data, acl, server_side_encryption, download_endpoint, download_endpoint_replacement_regex)
|
322
352
|
|
323
353
|
# Setting action and environment variables
|
324
354
|
Actions.lane_context[SharedValues::S3_APK_OUTPUT_PATH] = apk_url
|
@@ -376,9 +406,35 @@ module Fastlane
|
|
376
406
|
#####################################
|
377
407
|
|
378
408
|
skip_html = params[:skip_html_upload]
|
379
|
-
|
380
|
-
|
381
|
-
|
409
|
+
|
410
|
+
html_file_names = []
|
411
|
+
version_file_names = []
|
412
|
+
|
413
|
+
unless skip_html
|
414
|
+
if generate_html_in_root
|
415
|
+
html_file_names << html_file_name
|
416
|
+
end
|
417
|
+
if generate_html_in_folder
|
418
|
+
html_file_names << "#{url_part}#{html_file_name}"
|
419
|
+
end
|
420
|
+
end
|
421
|
+
if generate_version_in_root
|
422
|
+
version_file_names << version_file_name
|
423
|
+
end
|
424
|
+
if generate_version_in_folder
|
425
|
+
version_file_names << "#{url_part}#{version_file_name}"
|
426
|
+
end
|
427
|
+
|
428
|
+
html_url = nil
|
429
|
+
version_url = nil
|
430
|
+
|
431
|
+
html_file_names.each do |html_file_name|
|
432
|
+
html_url = self.upload_file(s3_client, s3_bucket, app_directory, html_file_name, html_render, acl, server_side_encryption, download_endpoint, download_endpoint_replacement_regex)
|
433
|
+
end
|
434
|
+
|
435
|
+
version_file_names do |version_file_name|
|
436
|
+
version_url = self.upload_file(s3_client, s3_bucket, app_directory, version_file_name, version_render, acl, server_side_encryption, download_endpoint, download_endpoint_replacement_regex)
|
437
|
+
end
|
382
438
|
|
383
439
|
Actions.lane_context[SharedValues::S3_HTML_OUTPUT_PATH] = html_url unless skip_html
|
384
440
|
ENV[SharedValues::S3_HTML_OUTPUT_PATH.to_s] = html_url unless skip_html
|
@@ -408,7 +464,9 @@ module Fastlane
|
|
408
464
|
zip_file_name = "#{url_part}source.zip"
|
409
465
|
|
410
466
|
output_path_data = File.open("#{output_file_path}", 'rb')
|
411
|
-
|
467
|
+
download_endpoint = params[:download_endpoint]
|
468
|
+
download_endpoint_replacement_regex = params[:download_endpoint_replacement_regex]
|
469
|
+
source_url = self.upload_file(s3_client, s3_bucket, app_directory, zip_file_name, output_path_data, acl, server_side_encryption, download_endpoint, download_endpoint_replacement_regex)
|
412
470
|
|
413
471
|
Actions.lane_context[SharedValues::S3_SOURCE_OUTPUT_PATH] = source_url
|
414
472
|
ENV[SharedValues::S3_SOURCE_OUTPUT_PATH.to_s] = source_url
|
@@ -494,13 +552,11 @@ module Fastlane
|
|
494
552
|
file_name = url_part + '/' + file_relative_path_to_folder
|
495
553
|
|
496
554
|
file_url = self.upload_file(s3_client, s3_bucket, app_directory, file_name, file_data, acl, server_side_encryption)
|
497
|
-
Actions.lane_context[SharedValues::S3_FOLDER_OUTPUT_PATH] = file_url.gsub('/' + file_relative_path_to_folder, '')
|
555
|
+
Actions.lane_context[SharedValues::S3_FOLDER_OUTPUT_PATH] = CGI.unescape(file_url).gsub('/' + file_relative_path_to_folder, '')
|
498
556
|
end
|
499
557
|
end
|
500
558
|
|
501
|
-
|
502
|
-
|
503
|
-
def self.upload_file(s3_client, bucket_name, app_directory, file_name, file_data, acl, server_side_encryption)
|
559
|
+
def self.upload_file(s3_client, bucket_name, app_directory, file_name, file_data, acl, server_side_encryption, download_endpoint, download_endpoint_replacement_regex)
|
504
560
|
|
505
561
|
if app_directory
|
506
562
|
file_name = "#{app_directory}/#{file_name}"
|
@@ -525,7 +581,14 @@ module Fastlane
|
|
525
581
|
end
|
526
582
|
|
527
583
|
# Return public url
|
528
|
-
obj.public_url.to_s
|
584
|
+
url = obj.public_url.to_s
|
585
|
+
|
586
|
+
# if a download endpoint is provided, then swap it in before returning
|
587
|
+
if download_endpoint
|
588
|
+
url = url.gsub(Regexp.new(download_endpoint_replacement_regex), download_endpoint)
|
589
|
+
end
|
590
|
+
|
591
|
+
return url
|
529
592
|
end
|
530
593
|
|
531
594
|
#
|
@@ -551,6 +614,12 @@ module Fastlane
|
|
551
614
|
return path
|
552
615
|
end
|
553
616
|
|
617
|
+
def self.expand_path_with_substitutions_with_versions(version_code, version_name, path)
|
618
|
+
path.gsub!(/\{version_code\}/, version_code.to_s) if version_code
|
619
|
+
path.gsub!(/\{version_name\}/, version_name) if version_name
|
620
|
+
return path
|
621
|
+
end
|
622
|
+
|
554
623
|
def self.description
|
555
624
|
"Generates a plist file and uploads all to AWS S3"
|
556
625
|
end
|
@@ -616,10 +685,28 @@ module Fastlane
|
|
616
685
|
is_string: false),
|
617
686
|
FastlaneCore::ConfigItem.new(key: :html_in_folder,
|
618
687
|
env_name: "",
|
619
|
-
description: "
|
688
|
+
description: "upload the html file into the version folder",
|
620
689
|
optional: true,
|
621
690
|
default_value: false,
|
622
691
|
is_string: false),
|
692
|
+
FastlaneCore::ConfigItem.new(key: :html_in_root,
|
693
|
+
env_name: "",
|
694
|
+
description: "upload the html file into the 'root' folder",
|
695
|
+
optional: true,
|
696
|
+
default_value: true,
|
697
|
+
is_string: false),
|
698
|
+
FastlaneCore::ConfigItem.new(key: :version_in_folder,
|
699
|
+
env_name: "",
|
700
|
+
description: "upload the version file into the version folder",
|
701
|
+
optional: true,
|
702
|
+
default_value: false,
|
703
|
+
is_string: false),
|
704
|
+
FastlaneCore::ConfigItem.new(key: :version_in_root,
|
705
|
+
env_name: "",
|
706
|
+
description: "upload the html file into the 'root' folder",
|
707
|
+
optional: true,
|
708
|
+
default_value: true,
|
709
|
+
is_string: false),
|
623
710
|
FastlaneCore::ConfigItem.new(key: :version_template_path,
|
624
711
|
env_name: "",
|
625
712
|
description: "version erb template path",
|
@@ -685,6 +772,16 @@ module Fastlane
|
|
685
772
|
description: "The base endpoint for your S3 bucket",
|
686
773
|
optional: true,
|
687
774
|
default_value: nil),
|
775
|
+
FastlaneCore::ConfigItem.new(key: :download_endpoint,
|
776
|
+
env_name: "S3_DOWNLOAD_ENDPOINT",
|
777
|
+
description: "The endpoint for downloads from your S3 bucket",
|
778
|
+
optional: true,
|
779
|
+
default_value: nil),
|
780
|
+
FastlaneCore::ConfigItem.new(key: :download_endpoint_replacement_regex,
|
781
|
+
env_name: "S3_DOWNLOAD_ENDPOINT_REPLACEMENT_REGEX",
|
782
|
+
description: "A regex used to determine which part of the S3 URL to replace with S3_DOWNLOAD_ENDPOINT",
|
783
|
+
optional: true,
|
784
|
+
default_value: '^https?://[^/]*'),
|
688
785
|
FastlaneCore::ConfigItem.new(key: :override_file_name,
|
689
786
|
env_name: "",
|
690
787
|
description: "Optional override ipa/apk uploaded file name",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-aws_s3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Holtz
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-s3
|
@@ -108,7 +108,7 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 2.144.0
|
111
|
-
description:
|
111
|
+
description:
|
112
112
|
email: josh@rokkincat.com
|
113
113
|
executables: []
|
114
114
|
extensions: []
|
@@ -129,7 +129,7 @@ homepage: https://github.com/fastlane-community/fastlane-plugin-s3
|
|
129
129
|
licenses:
|
130
130
|
- MIT
|
131
131
|
metadata: {}
|
132
|
-
post_install_message:
|
132
|
+
post_install_message:
|
133
133
|
rdoc_options: []
|
134
134
|
require_paths:
|
135
135
|
- lib
|
@@ -144,8 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
requirements: []
|
147
|
-
rubygems_version: 3.0.
|
148
|
-
signing_key:
|
147
|
+
rubygems_version: 3.0.3
|
148
|
+
signing_key:
|
149
149
|
specification_version: 4
|
150
150
|
summary: Upload IPA and APK to S3
|
151
151
|
test_files: []
|