fastlane-plugin-aws_s3 1.6.0 → 2.0.1

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
- SHA1:
3
- metadata.gz: 5d977b937cc7060f4b57f9cf32b0b27b347bce5a
4
- data.tar.gz: 8aaa4575eb1c388ea762f74f8a9e8207f248ac41
2
+ SHA256:
3
+ metadata.gz: 733d4e8ad5102e8eb943a08a22ceceff539415ec8cdd888780537294165f2c67
4
+ data.tar.gz: 47a788ae5954bd3fc3a9188debf847ba9b975fdeff29adb77badf170038f3b23
5
5
  SHA512:
6
- metadata.gz: b8fc79724b7fb26d1395c54b27f9f58e0e4c981e44fcfc9d8bbaaa7e67270426d4bcd90b5823c79f00efa964469884e6c4f5e13a3f02f5b5b4ad41b3b4536a07
7
- data.tar.gz: e29b765248b814c56fdfc14c3896a7f525909a0dff8905f5970f9564d11e101a76a10bd66b3e818bb20ab1aed75a9a5ed1d40a4a98df903e30933ee851f8db95
6
+ metadata.gz: c4f503580810e56959001b855fc677185a4acf240c5618f5d6ad9d871fb2277d0711b1ac93ff855817ef9073f7943d5cef4f98526d80763c31397c323b7f435f
7
+ data.tar.gz: c30c426048d89bbb43566057ee7d90c05684581ae1d8bfe6f6bd78fd9e625e403a746ccb5d680c4eed7ef7bc76ffec2b002297b8f6407eb5f3f1cfa6b619605b
data/README.md CHANGED
@@ -32,13 +32,13 @@ You can also customize a lot of options:
32
32
  ```ruby
33
33
  aws_s3(
34
34
  # All of these are used to make Shenzhen's `ipa distribute:s3` command
35
- access_key: ENV['S3_ACCESS_KEY'], # Required from user (unless using aws_profile).
36
- secret_access_key: ENV['S3_SECRET_ACCESS_KEY'], # Required from user (unless using aws_profile).
37
- aws_profile: ENV['AWS_PROFILE'] # Required from user (unless using access_key and secret_access_key)
35
+ access_key: ENV['S3_ACCESS_KEY'], # Optional - defaults to AWS Instance Profile Creds.
36
+ secret_access_key: ENV['S3_SECRET_ACCESS_KEY'], # Optional - defaults to AWS Instance Profile Creds.
37
+ aws_profile: ENV['AWS_PROFILE'], # Optional - defaults to AWS Instance Profile Creds. (overrides if access_key and secret_access_key specified)
38
38
  bucket: ENV['S3_BUCKET'], # Required from user.
39
39
  region: ENV['S3_REGION'], # Required from user.
40
40
  acl: ENV['S3_ACL'], # Optional - defaults to 'public-read'
41
- server_side_encryption: ENV['S3_SERVER_SIDE_ENCRYPTION'] # Optional
41
+ server_side_encryption: ENV['S3_SERVER_SIDE_ENCRYPTION'], # Optional
42
42
 
43
43
  endpoint: 'https://s3-us-west-1.amazonaws.com', # Optional, for buckets that require a specific endpoint
44
44
  ipa: 'AppName.ipa', # Required (if not uploading an APK).
@@ -55,7 +55,7 @@ aws_s3(
55
55
  )
56
56
  ```
57
57
 
58
- It is recommended to **not** store the AWS access keys in the `Fastfile`.
58
+ It is recommended to **not** store the AWS access keys in the `Fastfile`. You can use [AWS Instance Profiles](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2_instance-profiles.html) by attaching IAM roles to your EC2 configurations.
59
59
 
60
60
  The uploaded `version.json` file provides an easy way for apps to poll if a new update is available. The JSON looks like:
61
61
 
@@ -84,7 +84,4 @@ For more information about how the `fastlane` plugin system works, check out the
84
84
 
85
85
  ## Author
86
86
 
87
- Josh Holtz, josh@rokkincat.com, [@joshdholtz](https://twitter.com/joshdholtz)
88
-
89
- I'm available for freelance work (Fastlane, iOS, and Android development) :muscle:
90
- Feel free to contact me :rocket:
87
+ Josh Holtz, me@joshholtz.com, [@joshdholtz](https://twitter.com/joshdholtz)
@@ -43,6 +43,11 @@
43
43
  a:hover {
44
44
  text-decoration: underline;
45
45
  }
46
+ #os-message {
47
+ text-align: center;
48
+ color: #737373;
49
+ font-size: 14px;
50
+ }
46
51
  #footnote {
47
52
  color: #737373;
48
53
  font-size: 14px;
@@ -58,7 +63,6 @@
58
63
  <h1 style="text-align: center;"><%= title %></h1>
59
64
  <h2><%= version_name %> (<%= version_code %>)</h2>
60
65
  <p><em>Built on <%= Time.now.strftime('%a, %e %b %Y %H:%M %p') %></em></p>
61
- <!-- <img src="app_icon.png" id="appIcon"> -->
62
66
 
63
67
  <div class="oneRow">
64
68
  <span class="download" id="android">
@@ -70,31 +74,17 @@
70
74
  <span class="info">
71
75
  <p><%= release_notes %></p>
72
76
  </span>
73
-
74
- <!-- <span class="download" id="android">
75
- </span> -->
76
77
  </div>
77
78
 
78
- <h3 id="desktop">Please open this page on your Android device!</h3>
79
+ <h3 id="os-message">Please open this page on your Android device!</h3>
79
80
 
80
81
  <p id="finished">
81
82
  App is being installed. You might have to close the browser.
82
83
  </p>
83
84
 
84
85
  <p id="footnote">
85
- This is a beta version and is not meant to share with the public.
86
+ This is a beta version and is not intended for public sharing.
86
87
  </p>
87
- <img src="https://s3-eu-west-1.amazonaws.com/fastlane.tools/fastlane_medium.png" id="fastlaneLogo" />
88
+ <img src="https://fastlane.tools/assets/images/fastlane-logo-lockup.png" id="fastlaneLogo" />
88
89
  </body>
89
-
90
- <script type='text/javascript'>
91
- if (/Android/i.test(navigator.userAgent))
92
- {
93
- document.getElementById("desktop").remove()
94
- }
95
- else
96
- {
97
- document.getElementById("android").remove()
98
- }
99
- </script>
100
90
  </html>
@@ -3,5 +3,5 @@
3
3
  "updateUrl": "<%= apk_url %>",
4
4
  "version_code": "<%= version_code %>",
5
5
  "version_name": "<%= version_name %>",
6
- "release_notes": "<%= release_notes %>"
6
+ "release_notes": <%= release_notes.to_json %>
7
7
  }
@@ -43,6 +43,11 @@
43
43
  a:hover {
44
44
  text-decoration: underline;
45
45
  }
46
+ #os-message {
47
+ text-align: center;
48
+ color: #737373;
49
+ font-size: 14px;
50
+ }
46
51
  #footnote {
47
52
  color: #737373;
48
53
  font-size: 14px;
@@ -58,7 +63,6 @@
58
63
  <h1 style="text-align: center;"><%= title %></h1>
59
64
  <h2><%= bundle_version %> (<%= build_num %>)</h2>
60
65
  <p><em>Built on <%= Time.now.strftime('%a, %e %b %Y %H:%M %p') %></em></p>
61
- <!-- <img src="app_icon.png" id="appIcon"> -->
62
66
 
63
67
  <div class="oneRow">
64
68
 
@@ -71,38 +75,17 @@
71
75
  <span class="info">
72
76
  <p><%= release_notes %></p>
73
77
  </span>
74
-
75
- <!-- <span class="download" id="android">
76
- </span> -->
77
78
  </div>
78
79
 
79
- <h3 id="desktop">Please open this page on your iPhone!</h3>
80
+ <h3 id="os-message">Please open this page on your iOS device!</h3>
80
81
 
81
82
  <p id="finished">
82
83
  App is being installed. Close Safari using the home button.
83
84
  </p>
84
85
 
85
86
  <p id="footnote">
86
- This is a beta version and is not meant to share with the public.
87
+ This is a beta version and is not intended for public sharing.
87
88
  </p>
88
- <img src="https://s3-eu-west-1.amazonaws.com/fastlane.tools/fastlane_medium.png" id="fastlaneLogo" />
89
+ <img src="https://fastlane.tools/assets/images/fastlane-logo-lockup.png" id="fastlaneLogo" />
89
90
  </body>
90
-
91
- <script type='text/javascript'>
92
- // if (/Android/i.test(navigator.userAgent))
93
- // {
94
- // document.getElementById("ios").remove()
95
- // document.getElementById("desktop").remove()
96
- // }
97
- if (/iPhone|iPad|iPod/i.test(navigator.userAgent))
98
- {
99
- // document.getElementById("android").remove()
100
- document.getElementById("desktop").remove()
101
- }
102
- else
103
- {
104
- document.getElementById("ios").remove()
105
- // document.getElementById("android").remove()
106
- }
107
- </script>
108
91
  </html>
@@ -5,5 +5,5 @@
5
5
  "ipa_url": "<%= ipa_url %>",
6
6
  "build_number": "<%= build_num %>",
7
7
  "bundle_version": "<%= bundle_version %>",
8
- "release_notes": "<%= release_notes %>"
8
+ "release_notes": <%= release_notes.to_json %>
9
9
  }
@@ -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]
@@ -74,30 +79,19 @@ module Fastlane
74
79
  acl = params[:acl].to_sym
75
80
  server_side_encryption = params[:server_side_encryption]
76
81
 
77
- unless s3_profile
78
- UI.user_error!("No S3 access key given, pass using `access_key: 'key'` (or use `aws_profile: 'profile'`)") unless s3_access_key.to_s.length > 0
79
- UI.user_error!("No S3 secret access key given, pass using `secret_access_key: 'secret key'` (or use `aws_profile: 'profile'`)") unless s3_secret_access_key.to_s.length > 0
80
- end
81
82
  UI.user_error!("No S3 bucket given, pass using `bucket: 'bucket'`") unless s3_bucket.to_s.length > 0
82
83
  UI.user_error!("No IPA, APK file, folder or files paths given, pass using `ipa: 'ipa path'` or `apk: 'apk path'` or `folder: 'folder path' or files: [`file path1`, `file path 2`]") if ipa_file.to_s.length == 0 && apk_file.to_s.length == 0 && files.to_a.count == 0 && folder.to_s.length == 0
83
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
84
85
 
85
- require 'aws-sdk'
86
- if s3_profile
87
- creds = Aws::SharedCredentials.new(profile_name: s3_profile);
88
- else
89
- creds = Aws::Credentials.new(s3_access_key, s3_secret_access_key)
90
- end
91
- Aws.config.update({
92
- region: s3_region,
93
- credentials: creds
94
- })
86
+ require 'aws-sdk-s3'
95
87
 
96
- s3_client = if s3_endpoint
97
- Aws::S3::Client.new(endpoint: s3_endpoint)
98
- else
99
- Aws::S3::Client.new
100
- end
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
- html_file_name = "#{url_part}#{html_file_name}" if generate_html_in_folder
253
- html_url = self.upload_file(s3_client, s3_bucket, app_directory, html_file_name, html_render, acl, server_side_encryption) unless skip_html
254
- version_url = self.upload_file(s3_client, s3_bucket, app_directory, version_file_name, version_render, acl, server_side_encryption)
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 = "#{version_code}_#{version_name}/" unless 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
- html_file_name = "#{url_part}#{html_file_name}" if generate_html_in_folder
380
- html_url = self.upload_file(s3_client, s3_bucket, app_directory, html_file_name, html_render, acl, server_side_encryption) unless skip_html
381
- version_url = self.upload_file(s3_client, s3_bucket, app_directory, version_file_name, version_render, acl, server_side_encryption)
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
- source_url = self.upload_file(s3_client, s3_bucket, app_directory, zip_file_name, output_path_data, acl, server_side_encryption)
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
@@ -462,13 +520,16 @@ module Fastlane
462
520
  app_directory = params[:app_directory]
463
521
  url_part = s3_path
464
522
 
523
+ download_endpoint = params[:download_endpoint]
524
+ download_endpoint_replacement_regex = params[:download_endpoint_replacement_regex]
525
+
465
526
  Actions.lane_context[SharedValues::S3_FILES_OUTPUT_PATHS] = []
466
527
  files.each do |file|
467
528
  file_basename = File.basename(file)
468
529
  file_data = File.open(file, 'rb')
469
530
  file_name = url_part + '/' + file_basename
470
531
 
471
- file_url = self.upload_file(s3_client, s3_bucket, app_directory, file_name, file_data, acl, server_side_encryption)
532
+ file_url = self.upload_file(s3_client, s3_bucket, app_directory, file_name, file_data, acl, server_side_encryption, download_endpoint, download_endpoint_replacement_regex)
472
533
 
473
534
  # Setting action and environment variables
474
535
  Actions.lane_context[SharedValues::S3_FILES_OUTPUT_PATHS] << file_url
@@ -483,6 +544,9 @@ module Fastlane
483
544
  url_part = s3_path
484
545
  app_directory = params[:app_directory]
485
546
 
547
+ download_endpoint = params[:download_endpoint]
548
+ download_endpoint_replacement_regex = params[:download_endpoint_replacement_regex]
549
+
486
550
  unless File.directory?(folder)
487
551
  UI.user_error!("Invalid folder parameter. `#{File.expand_path(folder)} is not a directory!")
488
552
  end
@@ -493,14 +557,12 @@ module Fastlane
493
557
  file_relative_path_to_folder = Pathname.new(File.expand_path(file)).relative_path_from(Pathname.new(File.expand_path(folder))).to_s
494
558
  file_name = url_part + '/' + file_relative_path_to_folder
495
559
 
496
- 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, '')
560
+ file_url = self.upload_file(s3_client, s3_bucket, app_directory, file_name, file_data, acl, server_side_encryption, download_endpoint, download_endpoint_replacement_regex)
561
+ Actions.lane_context[SharedValues::S3_FOLDER_OUTPUT_PATH] = CGI.unescape(file_url).gsub('/' + file_relative_path_to_folder, '')
498
562
  end
499
563
  end
500
564
 
501
-
502
-
503
- def self.upload_file(s3_client, bucket_name, app_directory, file_name, file_data, acl, server_side_encryption)
565
+ 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
566
 
505
567
  if app_directory
506
568
  file_name = "#{app_directory}/#{file_name}"
@@ -525,7 +587,14 @@ module Fastlane
525
587
  end
526
588
 
527
589
  # Return public url
528
- obj.public_url.to_s
590
+ url = obj.public_url.to_s
591
+
592
+ # if a download endpoint is provided, then swap it in before returning
593
+ if download_endpoint
594
+ url = url.gsub(Regexp.new(download_endpoint_replacement_regex), download_endpoint)
595
+ end
596
+
597
+ return url
529
598
  end
530
599
 
531
600
  #
@@ -551,6 +620,12 @@ module Fastlane
551
620
  return path
552
621
  end
553
622
 
623
+ def self.expand_path_with_substitutions_with_versions(version_code, version_name, path)
624
+ path.gsub!(/\{version_code\}/, version_code.to_s) if version_code
625
+ path.gsub!(/\{version_name\}/, version_name) if version_name
626
+ return path
627
+ end
628
+
554
629
  def self.description
555
630
  "Generates a plist file and uploads all to AWS S3"
556
631
  end
@@ -616,10 +691,28 @@ module Fastlane
616
691
  is_string: false),
617
692
  FastlaneCore::ConfigItem.new(key: :html_in_folder,
618
693
  env_name: "",
619
- description: "move the uploaded html file into the version folder",
694
+ description: "upload the html file into the version folder",
695
+ optional: true,
696
+ default_value: false,
697
+ is_string: false),
698
+ FastlaneCore::ConfigItem.new(key: :html_in_root,
699
+ env_name: "",
700
+ description: "upload the html file into the 'root' folder",
701
+ optional: true,
702
+ default_value: true,
703
+ is_string: false),
704
+ FastlaneCore::ConfigItem.new(key: :version_in_folder,
705
+ env_name: "",
706
+ description: "upload the version file into the version folder",
620
707
  optional: true,
621
708
  default_value: false,
622
709
  is_string: false),
710
+ FastlaneCore::ConfigItem.new(key: :version_in_root,
711
+ env_name: "",
712
+ description: "upload the html file into the 'root' folder",
713
+ optional: true,
714
+ default_value: true,
715
+ is_string: false),
623
716
  FastlaneCore::ConfigItem.new(key: :version_template_path,
624
717
  env_name: "",
625
718
  description: "version erb template path",
@@ -685,6 +778,16 @@ module Fastlane
685
778
  description: "The base endpoint for your S3 bucket",
686
779
  optional: true,
687
780
  default_value: nil),
781
+ FastlaneCore::ConfigItem.new(key: :download_endpoint,
782
+ env_name: "S3_DOWNLOAD_ENDPOINT",
783
+ description: "The endpoint for downloads from your S3 bucket",
784
+ optional: true,
785
+ default_value: nil),
786
+ FastlaneCore::ConfigItem.new(key: :download_endpoint_replacement_regex,
787
+ env_name: "S3_DOWNLOAD_ENDPOINT_REPLACEMENT_REGEX",
788
+ description: "A regex used to determine which part of the S3 URL to replace with S3_DOWNLOAD_ENDPOINT",
789
+ optional: true,
790
+ default_value: '^https?://[^/]*'),
688
791
  FastlaneCore::ConfigItem.new(key: :override_file_name,
689
792
  env_name: "",
690
793
  description: "Optional override ipa/apk uploaded file name",
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module AwsS3
3
- VERSION = "1.6.0"
3
+ VERSION = "2.0.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-aws_s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 2.0.1
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: 2019-06-11 00:00:00.000000000 Z
11
+ date: 2021-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: aws-sdk
14
+ name: aws-sdk-s3
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.3'
19
+ version: '1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.3'
26
+ version: '1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: apktools
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.1'
47
+ version: '3.3'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.1'
54
+ version: '3.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pry
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -100,15 +100,15 @@ dependencies:
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 1.93.1
103
+ version: 2.144.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 1.93.1
111
- description:
110
+ version: 2.144.0
111
+ description:
112
112
  email: josh@rokkincat.com
113
113
  executables: []
114
114
  extensions: []
@@ -125,11 +125,11 @@ files:
125
125
  - lib/fastlane/plugin/aws_s3/actions/aws_s3_action.rb
126
126
  - lib/fastlane/plugin/aws_s3/helper/aws_s3_helper.rb
127
127
  - lib/fastlane/plugin/aws_s3/version.rb
128
- homepage: https://github.com/joshdholtz/fastlane-plugin-s3
128
+ 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,9 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  requirements: []
147
- rubyforge_project:
148
- rubygems_version: 2.5.2.3
149
- signing_key:
147
+ rubygems_version: 3.0.3
148
+ signing_key:
150
149
  specification_version: 4
151
150
  summary: Upload IPA and APK to S3
152
151
  test_files: []