fastlane-plugin-aws_s3 1.1.1 → 1.4.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 +121 -11
- data/lib/fastlane/plugin/aws_s3/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a63c90d33759731e791a4ea1896a666b157a6fc6
|
4
|
+
data.tar.gz: 47c38a853a9af3e88d3fb5ae30f167a49b7d1a01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9945bedf3f4fa8a7c905fddfdd42f450d2deaec314eeaeef885fa861136b6ef94ff5bd6c7ccd05afb23c14ce9b01b4f20941b2c43df89f88bfd86ba57303cc58
|
7
|
+
data.tar.gz: 99462a92926e3e0b167713541560c0b4530d9d1aa62fa283eb32854684faf3c17934812164191d1067e3a5c54fda28d791e921cbeb13efccec1df765d08957f9
|
@@ -4,6 +4,7 @@ include ERB::Util
|
|
4
4
|
require 'ostruct'
|
5
5
|
require 'cgi'
|
6
6
|
require 'mime-types'
|
7
|
+
require 'pathname'
|
7
8
|
|
8
9
|
module Fastlane
|
9
10
|
module Actions
|
@@ -15,6 +16,9 @@ module Fastlane
|
|
15
16
|
S3_HTML_OUTPUT_PATH ||= :S3_HTML_OUTPUT_PATH
|
16
17
|
S3_VERSION_OUTPUT_PATH ||= :S3_VERSION_OUTPUT_PATH
|
17
18
|
S3_SOURCE_OUTPUT_PATH ||= :S3_SOURCE_OUTPUT_PATH
|
19
|
+
S3_XCARCHIVE_OUTPUT_PATH ||= :S3_XCARCHIVE_OUTPUT_PATH
|
20
|
+
S3_FILES_OUTPUT_PATHS ||= :S3_FILES_OUTPUT_PATHS
|
21
|
+
S3_FOLDER_OUTPUT_PATH ||= :S3_FOLDER_OUTPUT_PATH
|
18
22
|
end
|
19
23
|
|
20
24
|
class AwsS3Action < Action
|
@@ -23,6 +27,7 @@ module Fastlane
|
|
23
27
|
params = {}
|
24
28
|
params[:apk] = config[:apk]
|
25
29
|
params[:ipa] = config[:ipa]
|
30
|
+
params[:xcarchive] = config[:xcarchive]
|
26
31
|
params[:dsym] = config[:dsym]
|
27
32
|
params[:access_key] = config[:access_key]
|
28
33
|
params[:secret_access_key] = config[:secret_access_key]
|
@@ -45,7 +50,10 @@ module Fastlane
|
|
45
50
|
params[:html_in_folder] = config[:html_in_folder]
|
46
51
|
params[:version_template_path] = config[:version_template_path]
|
47
52
|
params[:version_file_name] = config[:version_file_name]
|
53
|
+
params[:version_template_params] = config[:version_template_params]
|
48
54
|
params[:override_file_name] = config[:override_file_name]
|
55
|
+
params[:files] = config[:files]
|
56
|
+
params[:folder] = config[:folder]
|
49
57
|
|
50
58
|
# Pulling parameters for other uses
|
51
59
|
s3_region = params[:region]
|
@@ -56,6 +64,9 @@ module Fastlane
|
|
56
64
|
s3_endpoint = params[:endpoint]
|
57
65
|
apk_file = params[:apk]
|
58
66
|
ipa_file = params[:ipa]
|
67
|
+
xcarchive_file = params[:xcarchive]
|
68
|
+
files = params[:files]
|
69
|
+
folder = params[:folder]
|
59
70
|
dsym_file = params[:dsym]
|
60
71
|
s3_path = params[:path]
|
61
72
|
acl = params[:acl].to_sym
|
@@ -66,7 +77,7 @@ module Fastlane
|
|
66
77
|
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
|
67
78
|
end
|
68
79
|
UI.user_error!("No S3 bucket given, pass using `bucket: 'bucket'`") unless s3_bucket.to_s.length > 0
|
69
|
-
UI.user_error!("No IPA
|
80
|
+
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
|
70
81
|
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
|
71
82
|
|
72
83
|
require 'aws-sdk'
|
@@ -76,18 +87,21 @@ module Fastlane
|
|
76
87
|
creds = Aws::Credentials.new(s3_access_key, s3_secret_access_key)
|
77
88
|
end
|
78
89
|
Aws.config.update({
|
79
|
-
|
80
|
-
|
90
|
+
region: s3_region,
|
91
|
+
credentials: creds
|
81
92
|
})
|
82
93
|
|
83
94
|
s3_client = if s3_endpoint
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
95
|
+
Aws::S3::Client.new(endpoint: s3_endpoint)
|
96
|
+
else
|
97
|
+
Aws::S3::Client.new
|
98
|
+
end
|
88
99
|
|
89
100
|
upload_ipa(s3_client, params, s3_region, s3_access_key, s3_secret_access_key, s3_bucket, ipa_file, dsym_file, s3_path, acl, server_side_encryption) if ipa_file.to_s.length > 0
|
90
101
|
upload_apk(s3_client, params, s3_region, s3_access_key, s3_secret_access_key, s3_bucket, apk_file, s3_path, acl, server_side_encryption) if apk_file.to_s.length > 0
|
102
|
+
upload_xcarchive(s3_client, params, s3_region, s3_access_key, s3_secret_access_key, s3_bucket, ipa_file, xcarchive_file, s3_path, acl, server_side_encryption) if xcarchive_file.to_s.length > 0
|
103
|
+
upload_files(s3_client, params, s3_region, s3_access_key, s3_secret_access_key, s3_bucket, files, s3_path, acl, server_side_encryption) if files.to_a.count > 0
|
104
|
+
upload_folder(s3_client, params, s3_region, s3_access_key, s3_secret_access_key, s3_bucket, folder, s3_path, acl, server_side_encryption) if folder.to_s.length > 0
|
91
105
|
|
92
106
|
return true
|
93
107
|
end
|
@@ -105,6 +119,7 @@ module Fastlane
|
|
105
119
|
html_file_name = params[:html_file_name]
|
106
120
|
generate_html_in_folder = params[:html_in_folder]
|
107
121
|
version_template_path = params[:version_template_path]
|
122
|
+
version_template_params = params[:version_template_params] || {}
|
108
123
|
version_file_name = params[:version_file_name]
|
109
124
|
override_file_name = params[:override_file_name]
|
110
125
|
|
@@ -149,7 +164,7 @@ module Fastlane
|
|
149
164
|
build_num = info['CFBundleVersion']
|
150
165
|
bundle_id = info['CFBundleIdentifier']
|
151
166
|
bundle_version = info['CFBundleShortVersionString']
|
152
|
-
title = CGI.escapeHTML(info['
|
167
|
+
title = CGI.escapeHTML(info['CFBundleDisplayName'])
|
153
168
|
full_version = "#{bundle_version}.#{build_num}"
|
154
169
|
|
155
170
|
# Creating plist and html names
|
@@ -213,7 +228,7 @@ module Fastlane
|
|
213
228
|
build_num: build_num,
|
214
229
|
bundle_version: bundle_version,
|
215
230
|
full_version: full_version
|
216
|
-
})
|
231
|
+
}.merge(version_template_params))
|
217
232
|
|
218
233
|
#####################################
|
219
234
|
#
|
@@ -242,6 +257,29 @@ module Fastlane
|
|
242
257
|
UI.success("iOS app can be downloaded at '#{Actions.lane_context[SharedValues::S3_HTML_OUTPUT_PATH]}'") unless skip_html
|
243
258
|
end
|
244
259
|
|
260
|
+
def self.upload_xcarchive(s3_client, params, s3_region, s3_access_key, s3_secret_access_key, s3_bucket, ipa_file, archive, s3_path, acl, server_side_encryption)
|
261
|
+
|
262
|
+
s3_path = "v{CFBundleShortVersionString}_b{CFBundleVersion}/" unless s3_path
|
263
|
+
|
264
|
+
app_directory = params[:app_directory]
|
265
|
+
|
266
|
+
url_part = self.expand_path_with_substitutions_from_ipa_plist(ipa_file, s3_path)
|
267
|
+
|
268
|
+
archive_name = archive.gsub(' ','_')
|
269
|
+
archive_zip = "#{archive_name}.zip"
|
270
|
+
archive_zip_name = File.basename(archive_zip)
|
271
|
+
sh "zip -r #{archive_zip} \'#{archive}\'"
|
272
|
+
full_archive_zip_name = "#{url_part}#{archive_zip_name}"
|
273
|
+
archive_zip_data = File.open(archive_zip, 'rb')
|
274
|
+
|
275
|
+
archive_url = self.upload_file(s3_client, s3_bucket, app_directory, full_archive_zip_name, archive_zip_data, acl, server_side_encryption)
|
276
|
+
|
277
|
+
Actions.lane_context[SharedValues::S3_XCARCHIVE_OUTPUT_PATH] = archive_url
|
278
|
+
ENV[SharedValues::S3_XCARCHIVE_OUTPUT_PATH.to_s] = archive_url
|
279
|
+
|
280
|
+
UI.success("Successfully uploaded archive file to '#{Actions.lane_context[SharedValues::S3_XCARCHIVE_OUTPUT_PATH]}'")
|
281
|
+
end
|
282
|
+
|
245
283
|
def self.upload_apk(s3_client, params, s3_region, s3_access_key, s3_secret_access_key, s3_bucket, apk_file, s3_path, acl, server_side_encryption)
|
246
284
|
version = get_apk_version(apk_file)
|
247
285
|
|
@@ -258,6 +296,7 @@ module Fastlane
|
|
258
296
|
html_file_name = params[:html_file_name]
|
259
297
|
generate_html_in_folder = params[:html_in_folder]
|
260
298
|
version_template_path = params[:version_template_path]
|
299
|
+
version_template_params = params[:version_template_params] || {}
|
261
300
|
version_file_name = params[:version_file_name]
|
262
301
|
override_file_name = params[:override_file_name]
|
263
302
|
|
@@ -314,7 +353,7 @@ module Fastlane
|
|
314
353
|
version_code: version_code,
|
315
354
|
version_name: version_name,
|
316
355
|
full_version: "#{version_code}_#{version_name}"
|
317
|
-
})
|
356
|
+
}.merge(version_template_params))
|
318
357
|
|
319
358
|
#####################################
|
320
359
|
#
|
@@ -402,6 +441,51 @@ module Fastlane
|
|
402
441
|
[versionCode, versionName, name]
|
403
442
|
end
|
404
443
|
|
444
|
+
def self.upload_files(s3_client, params, s3_region, s3_access_key, s3_secret_access_key, s3_bucket, files, s3_path, acl, server_side_encryption)
|
445
|
+
|
446
|
+
s3_path = "files" unless s3_path
|
447
|
+
|
448
|
+
app_directory = params[:app_directory]
|
449
|
+
url_part = s3_path
|
450
|
+
|
451
|
+
Actions.lane_context[SharedValues::S3_FILES_OUTPUT_PATHS] = []
|
452
|
+
files.each do |file|
|
453
|
+
file_basename = File.basename(file)
|
454
|
+
file_data = File.open(file, 'rb')
|
455
|
+
file_name = url_part + '/' + file_basename
|
456
|
+
|
457
|
+
file_url = self.upload_file(s3_client, s3_bucket, app_directory, file_name, file_data, acl, server_side_encryption)
|
458
|
+
|
459
|
+
# Setting action and environment variables
|
460
|
+
Actions.lane_context[SharedValues::S3_FILES_OUTPUT_PATHS] << file_url
|
461
|
+
end
|
462
|
+
end
|
463
|
+
|
464
|
+
def self.upload_folder(s3_client, params, s3_region, s3_access_key, s3_secret_access_key, s3_bucket, folder, s3_path, acl, server_side_encryption)
|
465
|
+
|
466
|
+
s3_path = "files" unless s3_path
|
467
|
+
|
468
|
+
s3_path = s3_path.to_s + '/' + File.basename(folder)
|
469
|
+
url_part = s3_path
|
470
|
+
app_directory = params[:app_directory]
|
471
|
+
|
472
|
+
unless File.directory?(folder)
|
473
|
+
UI.user_error!("Invalid folder parameter. `#{File.expand_path(folder)} is not a directory!")
|
474
|
+
end
|
475
|
+
|
476
|
+
Dir.glob("#{folder}/**/*") do |file|
|
477
|
+
next if File.directory?(file)
|
478
|
+
file_data = File.open(file, 'rb')
|
479
|
+
file_relative_path_to_folder = Pathname.new(File.expand_path(file)).relative_path_from(Pathname.new(File.expand_path(folder))).to_s
|
480
|
+
file_name = url_part + '/' + file_relative_path_to_folder
|
481
|
+
|
482
|
+
file_url = self.upload_file(s3_client, s3_bucket, app_directory, file_name, file_data, acl, server_side_encryption)
|
483
|
+
Actions.lane_context[SharedValues::S3_FOLDER_OUTPUT_PATH] = file_url.gsub('/' + file_relative_path_to_folder, '')
|
484
|
+
end
|
485
|
+
end
|
486
|
+
|
487
|
+
|
488
|
+
|
405
489
|
def self.upload_file(s3_client, bucket_name, app_directory, file_name, file_data, acl, server_side_encryption)
|
406
490
|
|
407
491
|
if app_directory
|
@@ -469,6 +553,11 @@ module Fastlane
|
|
469
553
|
description: ".ipa file for the build ",
|
470
554
|
optional: true,
|
471
555
|
default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH]),
|
556
|
+
FastlaneCore::ConfigItem.new(key: :xcarchive,
|
557
|
+
env_name: "",
|
558
|
+
description: ".xcarchive file for the build ",
|
559
|
+
optional: true,
|
560
|
+
default_value: Actions.lane_context[SharedValues::XCODEBUILD_ARCHIVE]),
|
472
561
|
FastlaneCore::ConfigItem.new(key: :dsym,
|
473
562
|
env_name: "",
|
474
563
|
description: "zipped .dsym package for the build ",
|
@@ -517,6 +606,11 @@ module Fastlane
|
|
517
606
|
env_name: "",
|
518
607
|
description: "version erb template path",
|
519
608
|
optional: true),
|
609
|
+
FastlaneCore::ConfigItem.new(key: :version_template_params,
|
610
|
+
env_name: "",
|
611
|
+
description: "additional params for use in the version template",
|
612
|
+
optional: true,
|
613
|
+
type: Hash),
|
520
614
|
FastlaneCore::ConfigItem.new(key: :version_file_name,
|
521
615
|
env_name: "",
|
522
616
|
description: "uploaded version filename",
|
@@ -578,17 +672,33 @@ module Fastlane
|
|
578
672
|
description: "Optional override ipa/apk uploaded file name",
|
579
673
|
optional: true,
|
580
674
|
default_value: nil),
|
675
|
+
FastlaneCore::ConfigItem.new(key: :files,
|
676
|
+
env_name: "",
|
677
|
+
description: "Collection: Allows you to simply upload any files to s3. Ex: ['filename1', filename2]",
|
678
|
+
is_string: false,
|
679
|
+
optional: true,
|
680
|
+
default_value: nil),
|
681
|
+
FastlaneCore::ConfigItem.new(key: :folder,
|
682
|
+
env_name: "",
|
683
|
+
description: "Path to the folder you want to upload",
|
684
|
+
is_string: true,
|
685
|
+
optional: true,
|
686
|
+
default_value: nil),
|
581
687
|
]
|
582
688
|
end
|
583
689
|
|
584
690
|
def self.output
|
585
691
|
[
|
692
|
+
['S3_APK_OUTPUT_PATH', 'Direct HTTP link to the uploaded apk file'],
|
586
693
|
['S3_IPA_OUTPUT_PATH', 'Direct HTTP link to the uploaded ipa file'],
|
694
|
+
['S3_XCARCHIVE_OUTPUT_PATH', 'Direct HTTP link to the uploaded xcarchive file '],
|
587
695
|
['S3_DSYM_OUTPUT_PATH', 'Direct HTTP link to the uploaded dsym file'],
|
588
696
|
['S3_PLIST_OUTPUT_PATH', 'Direct HTTP link to the uploaded plist file'],
|
589
697
|
['S3_HTML_OUTPUT_PATH', 'Direct HTTP link to the uploaded HTML file'],
|
590
698
|
['S3_VERSION_OUTPUT_PATH', 'Direct HTTP link to the uploaded Version file'],
|
591
|
-
['S3_SOURCE_OUTPUT_PATH', 'Direct HTTP link to the uploaded source ']
|
699
|
+
['S3_SOURCE_OUTPUT_PATH', 'Direct HTTP link to the uploaded source '],
|
700
|
+
['S3_FILES_OUTPUT_PATHS', 'Collection of HTTP links to the uploaded files'],
|
701
|
+
['S3_FOLDER_OUTPUT_PATH', 'Direct HTTP link to the uploaded folder']
|
592
702
|
]
|
593
703
|
end
|
594
704
|
|
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: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Holtz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -145,9 +145,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
145
|
version: '0'
|
146
146
|
requirements: []
|
147
147
|
rubyforge_project:
|
148
|
-
rubygems_version: 2.5.2
|
148
|
+
rubygems_version: 2.5.2.3
|
149
149
|
signing_key:
|
150
150
|
specification_version: 4
|
151
151
|
summary: Upload IPA and APK to S3
|
152
152
|
test_files: []
|
153
|
-
has_rdoc:
|