fastlane-plugin-polidea 0.6.0.pre.1 → 2.2.0.pre
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 +5 -5
- data/README.md +3 -5
- data/lib/fastlane/plugin/polidea.rb +7 -0
- data/lib/fastlane/plugin/polidea/actions/add_prefix_schema.rb +4 -1
- data/lib/fastlane/plugin/polidea/actions/extract_app_icon.rb +4 -0
- data/lib/fastlane/plugin/polidea/actions/extract_app_info.rb +12 -9
- data/lib/fastlane/plugin/polidea/actions/extract_app_name.rb +4 -1
- data/lib/fastlane/plugin/polidea/actions/extract_version.rb +4 -0
- data/lib/fastlane/plugin/polidea/actions/{mailgun.rb → fota_mail.rb} +25 -21
- data/lib/fastlane/plugin/polidea/actions/{s3.rb → fota_s3.rb} +72 -51
- data/lib/fastlane/plugin/polidea/actions/get_binary_size.rb +4 -0
- data/lib/fastlane/plugin/polidea/actions/import_provisioning.rb +5 -0
- data/lib/fastlane/plugin/polidea/actions/release_notes.rb +5 -0
- data/lib/fastlane/plugin/polidea/actions/release_notes_from_commits.rb +54 -0
- data/lib/fastlane/plugin/polidea/actions/shuttle.rb +6 -38
- data/lib/fastlane/plugin/polidea/helper/analytics.rb +43 -0
- data/lib/fastlane/plugin/polidea/helper/mime.rb +22 -0
- data/lib/fastlane/plugin/polidea/helper/page_generator.rb +41 -3
- data/lib/fastlane/plugin/polidea/helper/qr_generator.rb +7 -7
- data/lib/fastlane/plugin/polidea/helper/shuttle.rb +39 -0
- data/lib/fastlane/plugin/polidea/templates/download.erb +481 -0
- data/lib/fastlane/plugin/polidea/templates/images/cover-shuttle.jpg +0 -0
- data/lib/fastlane/plugin/polidea/templates/images/icon-placeholder.png +0 -0
- data/lib/fastlane/plugin/polidea/templates/images/polidea-logo.png +0 -0
- data/lib/fastlane/plugin/polidea/templates/images/social-behance.png +0 -0
- data/lib/fastlane/plugin/polidea/templates/images/social-dribbble.png +0 -0
- data/lib/fastlane/plugin/polidea/templates/images/social-facebook.png +0 -0
- data/lib/fastlane/plugin/polidea/templates/images/social-github.png +0 -0
- data/lib/fastlane/plugin/polidea/templates/images/social-instagram.png +0 -0
- data/lib/fastlane/plugin/polidea/templates/images/social-linkedin.png +0 -0
- data/lib/fastlane/plugin/polidea/templates/images/social-twitter.png +0 -0
- data/lib/fastlane/plugin/polidea/templates/installation-page/css/installation-page.css +2835 -1082
- data/lib/fastlane/plugin/polidea/templates/installation_template.erb +3 -7
- data/lib/fastlane/plugin/polidea/templates/mailgun_template.erb +56 -24
- data/lib/fastlane/plugin/polidea/templates/secure_installation_template.erb +6 -10
- data/lib/fastlane/plugin/polidea/version.rb +1 -1
- metadata +100 -23
- data/lib/fastlane/plugin/polidea/actions/polidea_store.rb +0 -251
- data/lib/fastlane/plugin/polidea/templates/images/logo.png +0 -0
- data/lib/fastlane/plugin/polidea/templates/images/polidea-facebook-icon.png +0 -0
- data/lib/fastlane/plugin/polidea/templates/images/polidea-github-icon.png +0 -0
- data/lib/fastlane/plugin/polidea/templates/images/polidea-twitter-icon.png +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 195dd2dd89017eb5f7bbd37fbed5081b8c2ea42434114e7d2b3930385f7b084b
|
|
4
|
+
data.tar.gz: 3c58ca6693ead25acc9614bcfe4ae20af1f9326d2d69f801f46c4a52e6df7abf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce476129578f0e4302a1cc43373ff20e55f01a67dae595d95d13af8d07569d0534d8c961c17e12433e071a7bfe4b56cba8f961c6bf63946d9d128d8565def56a
|
|
7
|
+
data.tar.gz: f3e9a3d619bbcdb8c7f1d9df4886f567ee3d02c88eeab03cb56bd889f3494a1848750540a74a0a861e6d97a339f5249bf68cbce6b1edf93bfe1d4fcc4c35c65d
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# fastlane-plugin-polidea
|
|
2
2
|
|
|
3
|
-
[](https://gitlab.polidea.com/CICD/fastlane-plugin-polidea/pipelines)
|
|
4
4
|
[](http://rubygems.org/gems/fastlane-plugin-polidea)
|
|
5
5
|
|
|
6
6
|
|
|
@@ -20,8 +20,7 @@ Plugin contains following actions:
|
|
|
20
20
|
- `extract_version`: Extracts app version and build number from .ipa/.apk
|
|
21
21
|
- `get_binary_size`: Measures binary size in bytes
|
|
22
22
|
- `s3`: Custom version of s3 action with Polidea's installation page
|
|
23
|
-
- `
|
|
24
|
-
- `polidea_store`: Notifies Polidea Store about new app version
|
|
23
|
+
- `fota_mail`: Custom version of mailgun action with Polidea's mail template
|
|
25
24
|
|
|
26
25
|
See more details [here](https://gitlab2.polidea.com/CI/fastlane-plugin-polidea/blob/master/docs/Actions.md).
|
|
27
26
|
To list all available actions run:
|
|
@@ -39,8 +38,7 @@ lane :deploy do
|
|
|
39
38
|
extract_version
|
|
40
39
|
get_binary_size
|
|
41
40
|
s3
|
|
42
|
-
|
|
43
|
-
mailgun(
|
|
41
|
+
fota_mail(
|
|
44
42
|
to: "piotr.dubiel@polidea.com"
|
|
45
43
|
)
|
|
46
44
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'fastlane/plugin/polidea/version'
|
|
2
|
+
require 'fastlane/plugin/polidea/helper/analytics'
|
|
2
3
|
|
|
3
4
|
module Fastlane
|
|
4
5
|
module Polidea
|
|
@@ -6,6 +7,12 @@ module Fastlane
|
|
|
6
7
|
def self.all_classes
|
|
7
8
|
Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
|
|
8
9
|
end
|
|
10
|
+
|
|
11
|
+
def self.session
|
|
12
|
+
require 'securerandom'
|
|
13
|
+
@session_id ||= SecureRandom.uuid
|
|
14
|
+
@session ||= Analytics.new(@session_id)
|
|
15
|
+
end
|
|
9
16
|
end
|
|
10
17
|
end
|
|
11
18
|
|
|
@@ -8,9 +8,11 @@ module Fastlane
|
|
|
8
8
|
|
|
9
9
|
class AddPrefixSchemaAction < Action
|
|
10
10
|
def self.run(config)
|
|
11
|
+
Fastlane::Polidea.session.action_launched("add_prefix_schema", config)
|
|
12
|
+
|
|
11
13
|
prefix_schema = generate_url_scheme
|
|
12
14
|
|
|
13
|
-
info_plists = Dir.glob(File.join(config[:path], "
|
|
15
|
+
info_plists = Dir.glob(File.join(config[:path], "**/*.plist"))
|
|
14
16
|
UI.user_error!("There isn't any Info.plist in this directory") if info_plists.empty?
|
|
15
17
|
info_plists.each do |info_plist|
|
|
16
18
|
update_plist(info_plist, prefix_schema)
|
|
@@ -18,6 +20,7 @@ module Fastlane
|
|
|
18
20
|
|
|
19
21
|
Actions.lane_context[SharedValues::PREFIX_SCHEMA] = prefix_schema
|
|
20
22
|
|
|
23
|
+
Fastlane::Polidea.session.action_completed("add_prefix_schema")
|
|
21
24
|
prefix_schema
|
|
22
25
|
end
|
|
23
26
|
|
|
@@ -10,6 +10,8 @@ module Fastlane
|
|
|
10
10
|
|
|
11
11
|
class ExtractAppIconAction < Action
|
|
12
12
|
def self.run(config)
|
|
13
|
+
Fastlane::Polidea.session.action_launched("extract_app_icon", config)
|
|
14
|
+
|
|
13
15
|
platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME].to_sym
|
|
14
16
|
icon_output_path = config[:icon_output_path]
|
|
15
17
|
|
|
@@ -24,6 +26,8 @@ module Fastlane
|
|
|
24
26
|
else
|
|
25
27
|
UI.important("No icon found.")
|
|
26
28
|
end
|
|
29
|
+
|
|
30
|
+
Fastlane::Polidea.session.action_completed("extract_app_icon")
|
|
27
31
|
end
|
|
28
32
|
|
|
29
33
|
def self.extract_icon(platform, config)
|
|
@@ -15,6 +15,8 @@ module Fastlane
|
|
|
15
15
|
|
|
16
16
|
class ExtractAppInfoAction < Action
|
|
17
17
|
def self.run(config)
|
|
18
|
+
Fastlane::Polidea.session.action_launched("extract_app_info", config)
|
|
19
|
+
|
|
18
20
|
platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME].to_sym
|
|
19
21
|
|
|
20
22
|
icon_output_path = config[:icon_output_path]
|
|
@@ -34,6 +36,8 @@ module Fastlane
|
|
|
34
36
|
SharedValues::APP_VERSION => app_version,
|
|
35
37
|
SharedValues::BUILD_NUMBER => build_number
|
|
36
38
|
)
|
|
39
|
+
|
|
40
|
+
Fastlane::Polidea.session.action_completed("extract_app_info")
|
|
37
41
|
end
|
|
38
42
|
|
|
39
43
|
def self.validate(platform, config)
|
|
@@ -65,7 +69,7 @@ module Fastlane
|
|
|
65
69
|
case platform
|
|
66
70
|
when :ios
|
|
67
71
|
info = FastlaneCore::IpaFileAnalyser.fetch_info_plist_file(config[:ipa])
|
|
68
|
-
return info['CFBundleName'], info['CFBundleIdentifier']
|
|
72
|
+
return info['CFBundleDisplayName'] || info['CFBundleName'], info['CFBundleIdentifier']
|
|
69
73
|
when :android
|
|
70
74
|
apk = Android::Apk.new(config[:apk])
|
|
71
75
|
return apk.manifest.label, apk.manifest.package_name
|
|
@@ -133,7 +137,7 @@ module Fastlane
|
|
|
133
137
|
info = FastlaneCore::IpaFileAnalyser.fetch_info_plist_file(ipa_file)
|
|
134
138
|
icon_files = ipa_icon_files(info)
|
|
135
139
|
return if icon_files.empty?
|
|
136
|
-
icon_file_name = icon_files.
|
|
140
|
+
icon_file_name = icon_files.sort.last
|
|
137
141
|
Zip::File.open(ipa_file) do |zipfile|
|
|
138
142
|
icon_file = self.largest_ios_icon(zipfile.glob("**/Payload/**/#{icon_file_name}*.png"))
|
|
139
143
|
return nil unless icon_file
|
|
@@ -145,13 +149,12 @@ module Fastlane
|
|
|
145
149
|
end
|
|
146
150
|
|
|
147
151
|
def self.ipa_icon_files(info)
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
end
|
|
152
|
+
# try iPhone
|
|
153
|
+
icons = info.dig('CFBundleIcons', 'CFBundlePrimaryIcon', 'CFBundleIconFiles')
|
|
154
|
+
return icons unless icons.nil?
|
|
155
|
+
# try iPad
|
|
156
|
+
icons = info.dig('CFBundleIcons~ipad', 'CFBundlePrimaryIcon', 'CFBundleIconFiles')
|
|
157
|
+
return icons unless icons.nil?
|
|
155
158
|
[]
|
|
156
159
|
end
|
|
157
160
|
|
|
@@ -10,6 +10,8 @@ module Fastlane
|
|
|
10
10
|
|
|
11
11
|
class ExtractAppNameAction < Action
|
|
12
12
|
def self.run(config)
|
|
13
|
+
Fastlane::Polidea.session.action_launched("extract_app_name", config)
|
|
14
|
+
|
|
13
15
|
platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME].to_sym
|
|
14
16
|
|
|
15
17
|
# Gets name from ipa/apk
|
|
@@ -20,6 +22,7 @@ module Fastlane
|
|
|
20
22
|
|
|
21
23
|
UI.success("Successfully extracted app name: '#{Actions.lane_context[SharedValues::APP_NAME]}'")
|
|
22
24
|
|
|
25
|
+
Fastlane::Polidea.session.action_completed("extract_app_name")
|
|
23
26
|
app_name
|
|
24
27
|
end
|
|
25
28
|
|
|
@@ -41,7 +44,7 @@ module Fastlane
|
|
|
41
44
|
|
|
42
45
|
def self.extract_name_from_ipa(ipa_file)
|
|
43
46
|
info = FastlaneCore::IpaFileAnalyser.fetch_info_plist_file(ipa_file)
|
|
44
|
-
info['CFBundleName']
|
|
47
|
+
info['CFBundleDisplayName'] || info['CFBundleName']
|
|
45
48
|
end
|
|
46
49
|
|
|
47
50
|
######## android specific
|
|
@@ -11,6 +11,8 @@ module Fastlane
|
|
|
11
11
|
|
|
12
12
|
class ExtractVersionAction < Action
|
|
13
13
|
def self.run(config)
|
|
14
|
+
Fastlane::Polidea.session.action_launched("extract_version", config)
|
|
15
|
+
|
|
14
16
|
platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME].to_sym
|
|
15
17
|
|
|
16
18
|
# Gets version from ipa/apk
|
|
@@ -24,6 +26,8 @@ module Fastlane
|
|
|
24
26
|
|
|
25
27
|
UI.success("Successfully extracted app version: '#{Actions.lane_context[SharedValues::APP_VERSION]}', build number: #{Actions.lane_context[SharedValues::BUILD_NUMBER]}")
|
|
26
28
|
|
|
29
|
+
Fastlane::Polidea.session.action_completed("extract_version")
|
|
30
|
+
|
|
27
31
|
return app_version, build_number
|
|
28
32
|
end
|
|
29
33
|
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
# rubocop:disable Metrics/MethodLength
|
|
2
|
+
require 'redcarpet'
|
|
2
3
|
require 'fastlane/erb_template_helper'
|
|
3
4
|
|
|
4
5
|
module Fastlane
|
|
5
6
|
module Actions
|
|
6
|
-
class
|
|
7
|
+
class FotaMailAction < Action
|
|
7
8
|
def self.is_supported?(platform)
|
|
8
9
|
true
|
|
9
10
|
end
|
|
10
11
|
|
|
11
12
|
def self.run(options)
|
|
13
|
+
Fastlane::Polidea.session.action_launched("fota_mail", options)
|
|
14
|
+
|
|
12
15
|
Actions.verify_gem!('premailer')
|
|
13
16
|
require 'premailer'
|
|
14
17
|
inline_images(options)
|
|
15
18
|
mailgunit(options)
|
|
19
|
+
|
|
20
|
+
Fastlane::Polidea.session.action_completed("fota_mail")
|
|
21
|
+
UI.success "Mail sent!"
|
|
16
22
|
end
|
|
17
23
|
|
|
18
24
|
def self.description
|
|
@@ -51,6 +57,11 @@ module Fastlane
|
|
|
51
57
|
description: "Mail HTML template",
|
|
52
58
|
optional: true,
|
|
53
59
|
is_string: true),
|
|
60
|
+
FastlaneCore::ConfigItem.new(key: :platform,
|
|
61
|
+
env_name: "MAILGUN_PLATFORM",
|
|
62
|
+
description: "Platform used in mail template",
|
|
63
|
+
optional: true,
|
|
64
|
+
default_value: Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]),
|
|
54
65
|
FastlaneCore::ConfigItem.new(key: :app_icon,
|
|
55
66
|
env_name: "MAILGUN_APP_ICON",
|
|
56
67
|
description: "Path to app icon file",
|
|
@@ -99,24 +110,15 @@ module Fastlane
|
|
|
99
110
|
end
|
|
100
111
|
|
|
101
112
|
def self.inline_images(options)
|
|
102
|
-
base_path = "#{__dir__}/../templates/images"
|
|
103
113
|
options[:inline] = [
|
|
104
114
|
qr_code(options[:installation_link])
|
|
105
115
|
]
|
|
106
116
|
options[:inline] << File.new(options[:app_icon]) if options[:app_icon]
|
|
107
|
-
images = [
|
|
108
|
-
"polidea-facebook-icon.png",
|
|
109
|
-
"polidea-github-icon.png",
|
|
110
|
-
"polidea-logo.png",
|
|
111
|
-
"polidea-twitter-icon.png"
|
|
112
|
-
]
|
|
113
|
-
images << "icon-placeholder.png" unless options[:app_icon]
|
|
114
|
-
options[:inline].concat(images.map { |image| File.new("#{base_path}/#{image}") })
|
|
115
117
|
end
|
|
116
118
|
|
|
117
119
|
def self.qr_code(installation_link)
|
|
118
120
|
qr_code_path = "/tmp/qr_code.png"
|
|
119
|
-
QRGenerator.new(installation_link, false, ::ChunkyPNG::Color.rgb(
|
|
121
|
+
QRGenerator.new(installation_link, false, ::ChunkyPNG::Color.rgb(21, 18, 126)).generate(qr_code_path)
|
|
120
122
|
File.new(qr_code_path)
|
|
121
123
|
end
|
|
122
124
|
|
|
@@ -128,8 +130,8 @@ module Fastlane
|
|
|
128
130
|
https://api.mailgun.net/v3/#{sandbox_domain}/messages \
|
|
129
131
|
-F from='#{options[:from]} <#{options[:postmaster]}>' \
|
|
130
132
|
-F to='#{options[:to]}' \
|
|
131
|
-
-F subject='#{options[:app_name]} #{options[:app_version]} (#{options[:build_number]}) for #{
|
|
132
|
-
--form-string html=#{Shellwords.escape(body)} \ """ + options[:inline].map { |file| "-F inline=@#{file.path}" }.join(" "), print_command: false
|
|
133
|
+
-F subject='#{options[:app_name]} #{options[:app_version]} (#{options[:build_number]}) for #{options[:platform]} is ready to install' \
|
|
134
|
+
--form-string html=#{Shellwords.escape(body)} \ """ + options[:inline].map { |file| "-F inline=@#{file.path}" }.join(" "), print_command: false, print_command_output: false
|
|
133
135
|
|
|
134
136
|
return body
|
|
135
137
|
end
|
|
@@ -138,31 +140,33 @@ module Fastlane
|
|
|
138
140
|
hash = {
|
|
139
141
|
author: Actions.git_author_email,
|
|
140
142
|
last_commit: Actions.last_git_commit_message,
|
|
141
|
-
is_android:
|
|
143
|
+
is_android: options[:platform] == :android,
|
|
142
144
|
app_icon: options[:app_icon] ? File.basename(options[:app_icon]) : nil,
|
|
143
145
|
app_name: options[:app_name],
|
|
144
146
|
app_version: options[:app_version],
|
|
145
147
|
build_number: options[:build_number],
|
|
146
148
|
installation_link: options[:installation_link],
|
|
147
|
-
release_notes:
|
|
148
|
-
platform:
|
|
149
|
+
release_notes: options[:release_notes],
|
|
150
|
+
platform: options[:platform],
|
|
149
151
|
release_date: DateTime.now.strftime('%b %d, %Y'),
|
|
150
|
-
binary_size: (options[:binary_size] / 1024.0 / 1024.0).round(2).to_s
|
|
152
|
+
binary_size: (options[:binary_size] / 1024.0 / 1024.0).round(2).to_s,
|
|
153
|
+
qr_code: "qr_code.png"
|
|
151
154
|
}
|
|
152
155
|
hash[:success] = options[:success]
|
|
153
156
|
hash[:ci_build_link] = options[:ci_build_link]
|
|
154
157
|
|
|
155
|
-
# grabs module
|
|
156
|
-
eth = Fastlane::ErbTemplateHelper
|
|
157
158
|
# create html from template
|
|
158
159
|
html_template_path = options[:template_path]
|
|
159
160
|
if html_template_path && File.exist?(html_template_path)
|
|
161
|
+
eth = Fastlane::ErbTemplateHelper
|
|
160
162
|
html_template = eth.load_from_path(html_template_path)
|
|
163
|
+
mail_html = eth.render(html_template, hash)
|
|
161
164
|
else
|
|
162
|
-
|
|
165
|
+
mail_html = PageGenerator.mail(hash)
|
|
163
166
|
end
|
|
167
|
+
|
|
164
168
|
premailer = Premailer.new(
|
|
165
|
-
|
|
169
|
+
mail_html,
|
|
166
170
|
{ warn_level: Premailer::Warnings::SAFE, with_html_string: true }
|
|
167
171
|
)
|
|
168
172
|
premailer.to_inline_css
|
|
@@ -28,8 +28,10 @@ module Fastlane
|
|
|
28
28
|
path: '-P'
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
class
|
|
31
|
+
class FotaS3Action < Action
|
|
32
32
|
def self.run(config)
|
|
33
|
+
Fastlane::Polidea.session.action_launched("fota_s3", config)
|
|
34
|
+
|
|
33
35
|
platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME].to_sym
|
|
34
36
|
|
|
35
37
|
# Calling fetch on config so that default values will be used
|
|
@@ -51,6 +53,8 @@ module Fastlane
|
|
|
51
53
|
params[:version_file_name] = config[:version_file_name]
|
|
52
54
|
params[:acl] = config[:acl]
|
|
53
55
|
params[:installation_password] = config[:installation_password]
|
|
56
|
+
params[:release_notes] = config[:release_notes]
|
|
57
|
+
params[:treat_bucket_as_domain_name] = config[:treat_bucket_as_domain_name]
|
|
54
58
|
|
|
55
59
|
case platform
|
|
56
60
|
when :ios
|
|
@@ -59,6 +63,7 @@ module Fastlane
|
|
|
59
63
|
upload_android(params)
|
|
60
64
|
end
|
|
61
65
|
|
|
66
|
+
Fastlane::Polidea.session.action_completed("fota_s3")
|
|
62
67
|
return true
|
|
63
68
|
end
|
|
64
69
|
|
|
@@ -74,10 +79,14 @@ module Fastlane
|
|
|
74
79
|
dsym_file = params[:dsym]
|
|
75
80
|
acl = params[:acl]
|
|
76
81
|
installation_password = params[:installation_password]
|
|
82
|
+
release_notes = params[:release_notes]
|
|
83
|
+
treat_bucket_as_domain_name = params[:treat_bucket_as_domain_name]
|
|
77
84
|
|
|
78
85
|
validate(params)
|
|
79
86
|
UI.user_error!("No IPA file path given, pass using `ipa: 'ipa path'`") unless ipa_file.to_s.length > 0
|
|
80
87
|
|
|
88
|
+
UI.message("Will transform S3 urls from https://s3.amazonaws.com/#{s3_bucket} to https://#{s3_bucket}") if treat_bucket_as_domain_name
|
|
89
|
+
|
|
81
90
|
bucket = get_bucket(s3_access_key, s3_secret_access_key, s3_region, s3_bucket)
|
|
82
91
|
|
|
83
92
|
# Gets info used for the plist
|
|
@@ -86,7 +95,7 @@ module Fastlane
|
|
|
86
95
|
build_number = info['CFBundleVersion']
|
|
87
96
|
bundle_id = info['CFBundleIdentifier']
|
|
88
97
|
bundle_version = info['CFBundleShortVersionString']
|
|
89
|
-
app_name = info['CFBundleName']
|
|
98
|
+
app_name = info['CFBundleDisplayName'] || info['CFBundleName']
|
|
90
99
|
full_version = "#{bundle_version}.#{build_number}"
|
|
91
100
|
url_part = get_url_part(app_name, "ios", bundle_version, build_number)
|
|
92
101
|
|
|
@@ -99,7 +108,7 @@ module Fastlane
|
|
|
99
108
|
ipa_file_name = "#{url_part}#{ipa_file_basename}"
|
|
100
109
|
ipa_file_data = File.open(ipa_file, 'rb')
|
|
101
110
|
|
|
102
|
-
ipa_url = self.upload_file(bucket, ipa_file_name, ipa_file_data, acl)
|
|
111
|
+
ipa_url = self.upload_file(bucket, ipa_file_name, ipa_file_data, acl, treat_bucket_as_domain_name)
|
|
103
112
|
|
|
104
113
|
# Setting action and environment variables
|
|
105
114
|
Actions.lane_context[SharedValues::S3_IPA_OUTPUT_PATH] = ipa_url
|
|
@@ -110,12 +119,11 @@ module Fastlane
|
|
|
110
119
|
dsym_file_name = "#{url_part}#{dsym_file_basename}"
|
|
111
120
|
dsym_file_data = File.open(dsym_file, 'rb')
|
|
112
121
|
|
|
113
|
-
dsym_url = self.upload_file(bucket, dsym_file_name, dsym_file_data, acl)
|
|
122
|
+
dsym_url = self.upload_file(bucket, dsym_file_name, dsym_file_data, acl, treat_bucket_as_domain_name)
|
|
114
123
|
|
|
115
124
|
# Setting action and environment variables
|
|
116
125
|
Actions.lane_context[SharedValues::S3_DSYM_OUTPUT_PATH] = dsym_url
|
|
117
126
|
ENV[SharedValues::S3_DSYM_OUTPUT_PATH.to_s] = dsym_url
|
|
118
|
-
|
|
119
127
|
end
|
|
120
128
|
|
|
121
129
|
if params[:upload_metadata] == false
|
|
@@ -156,17 +164,18 @@ module Fastlane
|
|
|
156
164
|
})
|
|
157
165
|
|
|
158
166
|
# Gets icon from ipa and uploads it
|
|
159
|
-
icon_url = self.upload_icon(icon_file, url_part, bucket, acl)
|
|
167
|
+
icon_url = self.upload_icon(icon_file, url_part, bucket, acl, treat_bucket_as_domain_name)
|
|
160
168
|
|
|
161
169
|
# Creates html from template
|
|
162
|
-
html_render = PageGenerator.
|
|
170
|
+
html_render = PageGenerator.installation_page({
|
|
163
171
|
url: "itms-services://?action=download-manifest&url=#{URI.encode_www_form_component(plist_url)}",
|
|
164
172
|
installation_password: installation_password,
|
|
165
173
|
app_version: bundle_version,
|
|
166
174
|
build_number: build_number,
|
|
167
175
|
app_name: app_name,
|
|
168
176
|
app_icon: icon_url,
|
|
169
|
-
platform: "ios"
|
|
177
|
+
platform: "ios",
|
|
178
|
+
release_notes: release_notes
|
|
170
179
|
})
|
|
171
180
|
|
|
172
181
|
# Creates version from template
|
|
@@ -190,10 +199,10 @@ module Fastlane
|
|
|
190
199
|
#
|
|
191
200
|
#####################################
|
|
192
201
|
|
|
193
|
-
plist_url = self.upload_file(bucket, plist_file_name, plist_render, acl)
|
|
194
|
-
html_url = self.upload_file(bucket, html_file_name, html_render, acl)
|
|
202
|
+
plist_url = self.upload_file(bucket, plist_file_name, plist_render, acl, treat_bucket_as_domain_name)
|
|
203
|
+
html_url = self.upload_file(bucket, html_file_name, html_render, acl, treat_bucket_as_domain_name)
|
|
195
204
|
self.upload_directory(bucket, html_resources_name, "#{__dir__}/../templates/installation-page", acl)
|
|
196
|
-
version_url = self.upload_file(bucket, version_file_name, version_render, acl)
|
|
205
|
+
version_url = self.upload_file(bucket, version_file_name, version_render, acl, treat_bucket_as_domain_name)
|
|
197
206
|
|
|
198
207
|
# Setting action and environment variables
|
|
199
208
|
Actions.lane_context[SharedValues::S3_PLIST_OUTPUT_PATH] = plist_url
|
|
@@ -227,10 +236,14 @@ module Fastlane
|
|
|
227
236
|
icon_file = params[:icon]
|
|
228
237
|
acl = params[:acl]
|
|
229
238
|
installation_password = params[:installation_password]
|
|
239
|
+
release_notes = params[:release_notes]
|
|
240
|
+
treat_bucket_as_domain_name = params[:treat_bucket_as_domain_name]
|
|
230
241
|
|
|
231
242
|
validate(params)
|
|
232
243
|
UI.user_error!("No APK file path given, pass using `apk: 'apk path'`") unless apk_file.to_s.length > 0
|
|
233
244
|
|
|
245
|
+
UI.message("Will transform S3 urls from https://s3.amazonaws.com/#{s3_bucket} to https://#{s3_bucket}") if treat_bucket_as_domain_name
|
|
246
|
+
|
|
234
247
|
bucket = get_bucket(s3_access_key, s3_secret_access_key, s3_region, s3_bucket)
|
|
235
248
|
|
|
236
249
|
# Gets info used from the apk manifest
|
|
@@ -247,7 +260,7 @@ module Fastlane
|
|
|
247
260
|
apk_file_name = "#{url_part}#{apk_file_basename}"
|
|
248
261
|
apk_file_data = File.open(apk_file, 'rb')
|
|
249
262
|
|
|
250
|
-
apk_url = self.upload_file(bucket, apk_file_name, apk_file_data, acl)
|
|
263
|
+
apk_url = self.upload_file(bucket, apk_file_name, apk_file_data, acl, treat_bucket_as_domain_name)
|
|
251
264
|
|
|
252
265
|
# Setting action and environment variables
|
|
253
266
|
Actions.lane_context[SharedValues::S3_APK_OUTPUT_PATH] = apk_url
|
|
@@ -265,20 +278,21 @@ module Fastlane
|
|
|
265
278
|
html_resources_name = "#{url_part}installation-page"
|
|
266
279
|
|
|
267
280
|
# Gets icon from ipa and uploads it
|
|
268
|
-
icon_url = self.upload_icon(icon_file, url_part, bucket, acl)
|
|
281
|
+
icon_url = self.upload_icon(icon_file, url_part, bucket, acl, treat_bucket_as_domain_name)
|
|
269
282
|
|
|
270
283
|
# Creates html from template
|
|
271
|
-
html_render = PageGenerator.
|
|
284
|
+
html_render = PageGenerator.installation_page({
|
|
272
285
|
url: apk_url,
|
|
273
286
|
installation_password: installation_password,
|
|
274
287
|
app_version: app_version,
|
|
275
288
|
build_number: build_number,
|
|
276
289
|
app_name: app_name,
|
|
277
290
|
app_icon: icon_url,
|
|
278
|
-
platform: "android"
|
|
291
|
+
platform: "android",
|
|
292
|
+
release_notes: release_notes
|
|
279
293
|
})
|
|
280
294
|
|
|
281
|
-
html_url = self.upload_file(bucket, html_file_name, html_render, acl)
|
|
295
|
+
html_url = self.upload_file(bucket, html_file_name, html_render, acl, treat_bucket_as_domain_name)
|
|
282
296
|
self.upload_directory(bucket, html_resources_name, "#{__dir__}/../templates/installation-page", acl)
|
|
283
297
|
|
|
284
298
|
Actions.lane_context[SharedValues::S3_HTML_OUTPUT_PATH] = html_url
|
|
@@ -310,20 +324,21 @@ module Fastlane
|
|
|
310
324
|
end
|
|
311
325
|
|
|
312
326
|
def self.get_bucket(s3_access_key, s3_secret_access_key, s3_region, s3_bucket)
|
|
313
|
-
self.s3_client(s3_access_key, s3_secret_access_key, s3_region).
|
|
327
|
+
self.s3_client(s3_access_key, s3_secret_access_key, s3_region).bucket(s3_bucket)
|
|
314
328
|
end
|
|
315
329
|
|
|
316
330
|
def self.s3_client(s3_access_key, s3_secret_access_key, s3_region)
|
|
317
|
-
Actions.verify_gem!('aws-sdk')
|
|
318
|
-
require 'aws-sdk'
|
|
331
|
+
Actions.verify_gem!('aws-sdk-s3')
|
|
332
|
+
require 'aws-sdk-s3'
|
|
333
|
+
|
|
319
334
|
if s3_region
|
|
320
|
-
s3_client =
|
|
335
|
+
s3_client = Aws::S3::Resource.new(
|
|
321
336
|
access_key_id: s3_access_key,
|
|
322
337
|
secret_access_key: s3_secret_access_key,
|
|
323
338
|
region: s3_region
|
|
324
339
|
)
|
|
325
340
|
else
|
|
326
|
-
s3_client =
|
|
341
|
+
s3_client = Aws::S3::Resource.new(
|
|
327
342
|
access_key_id: s3_access_key,
|
|
328
343
|
secret_access_key: s3_secret_access_key
|
|
329
344
|
)
|
|
@@ -331,19 +346,28 @@ module Fastlane
|
|
|
331
346
|
s3_client
|
|
332
347
|
end
|
|
333
348
|
|
|
334
|
-
def self.upload_file(bucket, file_name, file_data, acl)
|
|
335
|
-
obj = bucket.
|
|
349
|
+
def self.upload_file(bucket, file_name, file_data, acl, treat_bucket_as_domain_name)
|
|
350
|
+
obj = bucket.put_object({
|
|
351
|
+
key: file_name,
|
|
352
|
+
body: file_data,
|
|
353
|
+
acl: acl,
|
|
354
|
+
content_type: Mime.content_type_for_file(file_name)
|
|
355
|
+
})
|
|
336
356
|
|
|
337
357
|
# When you enable versioning on a S3 bucket,
|
|
338
358
|
# writing to an object will create an object version
|
|
339
359
|
# instead of replacing the existing object.
|
|
340
360
|
# http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/S3/ObjectVersion.html
|
|
341
|
-
if obj.kind_of?
|
|
361
|
+
if obj.kind_of? Aws::S3::ObjectVersion
|
|
342
362
|
obj = obj.object
|
|
343
363
|
end
|
|
344
364
|
|
|
345
|
-
|
|
346
|
-
|
|
365
|
+
if treat_bucket_as_domain_name
|
|
366
|
+
# Return public url
|
|
367
|
+
shorten_url(obj.public_url.to_s)
|
|
368
|
+
else
|
|
369
|
+
obj.public_url.to_s
|
|
370
|
+
end
|
|
347
371
|
end
|
|
348
372
|
|
|
349
373
|
def self.upload_directory(bucket, directory_name, directory_path, acl)
|
|
@@ -352,8 +376,13 @@ module Fastlane
|
|
|
352
376
|
files.each do |file|
|
|
353
377
|
local_path = directory_path + file
|
|
354
378
|
s3_path = directory_name + file
|
|
355
|
-
|
|
356
|
-
|
|
379
|
+
|
|
380
|
+
bucket.put_object({
|
|
381
|
+
key: s3_path,
|
|
382
|
+
body: File.open(local_path),
|
|
383
|
+
acl: acl,
|
|
384
|
+
content_type: Mime.content_type_for_file(local_path)
|
|
385
|
+
})
|
|
357
386
|
end
|
|
358
387
|
end
|
|
359
388
|
|
|
@@ -373,25 +402,6 @@ module Fastlane
|
|
|
373
402
|
return files
|
|
374
403
|
end
|
|
375
404
|
|
|
376
|
-
def self.content_type_for_file(file)
|
|
377
|
-
file_extension = File.extname(file)
|
|
378
|
-
extensions_to_type = {
|
|
379
|
-
".html" => "text/html",
|
|
380
|
-
".png" => "image/png",
|
|
381
|
-
".jpg" => "text/jpeg",
|
|
382
|
-
".gif" => "image/gif",
|
|
383
|
-
".svg" => "image/svg+xml",
|
|
384
|
-
".log" => "text/plain",
|
|
385
|
-
".css" => "text/css",
|
|
386
|
-
".js" => "application/javascript"
|
|
387
|
-
}
|
|
388
|
-
if extensions_to_type[file_extension].nil?
|
|
389
|
-
"application/octet-stream"
|
|
390
|
-
else
|
|
391
|
-
extensions_to_type[file_extension]
|
|
392
|
-
end
|
|
393
|
-
end
|
|
394
|
-
|
|
395
405
|
#
|
|
396
406
|
# NOT a fan of this as this was taken straight from Shenzhen
|
|
397
407
|
# https://github.com/nomad/shenzhen/blob/986792db5d4d16a80c865a2748ee96ba63644821/lib/shenzhen/plugins/s3.rb#L32
|
|
@@ -415,12 +425,12 @@ module Fastlane
|
|
|
415
425
|
return path
|
|
416
426
|
end
|
|
417
427
|
|
|
418
|
-
def self.upload_icon(icon_path, url_part, bucket, acl)
|
|
428
|
+
def self.upload_icon(icon_path, url_part, bucket, acl, treat_bucket_as_domain_name)
|
|
419
429
|
return unless icon_path
|
|
420
430
|
icon_file_basename = File.basename(icon_path)
|
|
421
431
|
icon_file = File.open(icon_path)
|
|
422
432
|
icon_file_name = "#{url_part}#{icon_file_basename}"
|
|
423
|
-
self.upload_file(bucket, icon_file_name, icon_file, acl)
|
|
433
|
+
self.upload_file(bucket, icon_file_name, icon_file, acl, treat_bucket_as_domain_name)
|
|
424
434
|
end
|
|
425
435
|
|
|
426
436
|
def self.shorten_url(url)
|
|
@@ -504,12 +514,23 @@ module Fastlane
|
|
|
504
514
|
env_name: "S3_ACL",
|
|
505
515
|
description: "Uploaded object permissions e.g public_read (default), private, public_read_write, authenticated_read ",
|
|
506
516
|
optional: true,
|
|
507
|
-
default_value: "
|
|
517
|
+
default_value: "public-read"),
|
|
508
518
|
FastlaneCore::ConfigItem.new(key: :installation_password,
|
|
509
519
|
env_name: "INSTALLATION_PASSWORD",
|
|
510
520
|
description: "Password for installation page",
|
|
511
521
|
optional: true,
|
|
512
|
-
default_value: nil)
|
|
522
|
+
default_value: nil),
|
|
523
|
+
FastlaneCore::ConfigItem.new(key: :release_notes,
|
|
524
|
+
env_name: "S3_RELEASE_NOTES",
|
|
525
|
+
description: "Release notes",
|
|
526
|
+
type: String,
|
|
527
|
+
optional: true,
|
|
528
|
+
default_value: Actions.lane_context[SharedValues::RELEASE_NOTES]),
|
|
529
|
+
FastlaneCore::ConfigItem.new(key: :treat_bucket_as_domain_name,
|
|
530
|
+
description: "If it's true, it transforms all urls from https://s3.amazonaws.com/BUCKET_NAME to https://BUCKET_NAME",
|
|
531
|
+
is_string: false,
|
|
532
|
+
optional: true,
|
|
533
|
+
default_value: true)
|
|
513
534
|
]
|
|
514
535
|
end
|
|
515
536
|
|