fastlane-plugin-testbm 0.1.15 → 0.1.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7a73bcd0e62fa3734a5a7780a5e34eebedc2e00134b8b93e14578f6d3784ed1
4
- data.tar.gz: 9ac56da580fa021a92f4995c3f0afd203df558193e556268eb540f62cd5c6191
3
+ metadata.gz: 840bfbe54cca326ac344da1488fd7c98977ef154019e18eaa47ef17bce79a555
4
+ data.tar.gz: b1859c305e01379e8eb98ee8ba530023ee7ca766d97af838a40a4587b7aecda3
5
5
  SHA512:
6
- metadata.gz: 07e1b9292a96f1558a646e45e975d27308c1490df0dacd0b80baf19c2587f5b21300d5bbbf7989759a871739e150d323f75e79460e55410d94d5c446b241e765
7
- data.tar.gz: 6cf611a62b7f7c91f97097d1d2de9b107ef3ddd66368d2c94b9c61158db1c10db7873798b288e89a6186e9339e6168a35faf2a760a656fcb68ab51eedea00634
6
+ metadata.gz: ac3e9e8ca955304ddcbe4305ed8cc2ba02307f669ad586f5f6c001830551b0228048ada5ecfa3609c6ff9452e3d6bb599e3d1953da46d2a7bb031ca2eeaeddaf
7
+ data.tar.gz: 421693dad056dcaafd5d4d90a1a55043120605cdf6ed928034f9779dfdb84ccce0f35c89a4c9ad3bc1e3a784956a37464a59a539d22dc48a53479ffe9ff19173
@@ -0,0 +1,144 @@
1
+ require 'fastlane/action'
2
+
3
+ module Fastlane
4
+ module Actions
5
+ class BmdistributionAction < Action
6
+ def self.run(params)
7
+ app_information = params[:app_information]
8
+ platform_type = params[:platform_type]
9
+ self.distribution_func_send_to_firebase(app_information, platform_type)
10
+ UI.message("Version distributed!")
11
+ end
12
+
13
+ def self.description
14
+ "Distributes an app version via firebase, testflight, browsertack or the play store."
15
+ end
16
+
17
+ def self.authors
18
+ ["Bemobile"]
19
+ end
20
+
21
+ def self.return_value
22
+ # If your method provides a return value, you can describe here what it does
23
+ end
24
+
25
+ def self.details
26
+ "TODO"
27
+ end
28
+
29
+ def self.available_options
30
+ [
31
+ FastlaneCore::ConfigItem.new(key: :app_information,
32
+ env_name: "APP_INFORMATION",
33
+ description: "The app information including name, version.",
34
+ optional: false,
35
+ type: Array),
36
+ FastlaneCore::ConfigItem.new(key: :platform_type,
37
+ env_name: "PLATFORM_TYPE",
38
+ description: "Indicates platform wheter android or ios",
39
+ optional: false,
40
+ type: String)
41
+ ]
42
+ end
43
+
44
+ def self.is_supported?(platform)
45
+ true
46
+ end
47
+
48
+ def self.distribution_func_send_to_firebase(app_information, platform_type)
49
+ version_info = Helper::BmHelper.version_func_get_version(platform_type:platform_type)
50
+ fabric_build_number = version_info[:build_number]
51
+
52
+ # set other information for fabric
53
+ fabric_app_name = app_information[:app_name]
54
+ fabric_changelogs_description = app_information[:changelog]
55
+ fabric_notes = "Version #{fabric_build_number} from #{fabric_app_name} \n\n#{fabric_changelogs_description}"
56
+ fabric_groups = nil
57
+ fabric_mails = nil
58
+
59
+ # SEND VERSION
60
+ fabric_groups = ""
61
+ fabric_mails = ""
62
+ firebase_app_id = ""
63
+ if platform_type == Helper::BmHelper::CONST_PROJECT_TYPE__IOS
64
+ if app_information[:environment] == Helper::BmHelper::CONST_PROJECT_ENVIRONMENT__PROD
65
+ fabric_groups = ENV["PRIVATE_IOS_FABRIC_GROUPS_PROD"]
66
+ fabric_mails = ENV["PRIVATE_IOS_FABRIC_MAILS_PROD"]
67
+ firebase_app_id = ENV["PRIVATE_FIREBASE_APP_ID_IOS_PROD"]
68
+ else
69
+ fabric_groups = ENV["PRIVATE_IOS_FABRIC_GROUPS_DEV"]
70
+ fabric_mails = ENV["PRIVATE_IOS_FABRIC_MAILS_DEV"]
71
+ firebase_app_id = ENV["PRIVATE_FIREBASE_APP_ID_IOS_DEV"]
72
+ end
73
+ elsif
74
+ if app_information[:environment] == Helper::BmHelper::CONST_PROJECT_ENVIRONMENT__PROD
75
+ fabric_groups = ENV["PRIVATE_ANDROID_FABRIC_GROUPS_PROD"]
76
+ fabric_mails = ENV["PRIVATE_ANDROID_FABRIC_MAILS_PROD"]
77
+ firebase_app_id = ENV["PRIVATE_FIREBASE_APP_ID_ANDROID_PROD"]
78
+ else
79
+ fabric_groups = ENV["PRIVATE_ANDROID_FABRIC_GROUPS_DEV"]
80
+ fabric_mails = ENV["PRIVATE_ANDROID_FABRIC_MAILS_DEV"]
81
+ firebase_app_id = ENV["PRIVATE_FIREBASE_APP_ID_ANDROID_DEV"]
82
+ end
83
+ end
84
+
85
+ firebase_login_token = ENV["FIREBASE_LOGIN_TOKEN"]
86
+ if fabric_groups.length > 0 && fabric_mails.length > 0
87
+ other_action.firebase_app_distribution(app: firebase_app_id, firebase_cli_token: firebase_login_token, testers: fabric_mails, groups: fabric_groups, release_notes: fabric_notes)
88
+ elsif fabric_groups.length > 0
89
+ other_action.firebase_app_distribution(app: firebase_app_id, firebase_cli_token: firebase_login_token, groups: fabric_groups, release_notes: fabric_notes)
90
+ elsif fabric_mails.length > 0
91
+ other_action.firebase_app_distribution(app: firebase_app_id, firebase_cli_token: firebase_login_token, testers: fabric_mails, release_notes: fabric_notes)
92
+ else
93
+ other_action.firebase_app_distribution(app: firebase_app_id, firebase_cli_token: firebase_login_token, release_notes: fabric_notes)
94
+ end
95
+
96
+ message_text = "#{app_information[:app_name]} App successfully released to Firebase!"
97
+ other_action.bmslack(message_text: message_text)
98
+ end
99
+
100
+ def self.distribution_func_send_to_browserstack(app_information, apk_location, platform_type)
101
+ version_info = Helper::BmHelper.version_func_get_version(platform_type:platform_type)
102
+ username = ENV["BROWSERSTACK_USERNAME"]
103
+ access_key = ENV["BROWSERSTACK_ACCESS_KEY"]
104
+
105
+ apk_path = File.dirname(apk_location)
106
+ apk_new_path = apk_path + "/#{app_information[:app_name]}_#{app_information[:environment]}_#{version_info[:version_number]}_#{version_info[:build_number]}.apk"
107
+ File.rename(apk_location, apk_new_path)
108
+ other_action.upload_to_browserstack_app_live(browserstack_username: username, browserstack_access_key: access_key, file_path: apk_new_path)
109
+ end
110
+
111
+ def self.distribution_func_testflight(app_information)
112
+ version_info = Helper::BmHelper.version_func_get_version(platform_type:Helper::BmHelper::CONST_PROJECT_TYPE__IOS)
113
+ testflight_notes = "Version #{version_info[:build_number]} from #{app_information[:app_name]} \n\n#{app_information[:changelog]}"
114
+
115
+ testflight_groups = nil
116
+ if app_information[:environment] == Helper::BmHelper::CONST_PROJECT_ENVIRONMENT__PROD
117
+ testflight_groups = ENV["PRIVATE_FABRIC_GROUPS_PROD"]
118
+ else
119
+ testflight_groups = ENV["PRIVATE_FABRIC_GROUPS_DEV"]
120
+ end
121
+ testflight_groups = testflight_groups.split(",")
122
+
123
+ # upload to Testflight
124
+ other_action.pilot(
125
+ changelog: testflight_notes,
126
+ skip_submission: false,
127
+ skip_waiting_for_build_processing: true,
128
+ distribute_external: true,
129
+ app_identifier: version_info[:ios][:bundle_id],
130
+ groups: testflight_groups)
131
+
132
+ message_text = "#{app_information[:app_name]} App successfully released to TestFlight!"
133
+ other_action.bmslack(message_text: message_text)
134
+ end
135
+
136
+ def self.distribution_func_itunes_connect(app_information)
137
+ other_action.appstore(force: true, skip_screenshots: true)
138
+ message_text = "#{app_information[:app_name]} App successfully uploaded to Itunes Connect!"
139
+ other_action.bmslack(message_text: message_text)
140
+ end
141
+
142
+ end
143
+ end
144
+ end
@@ -0,0 +1,84 @@
1
+ require 'fastlane/action'
2
+
3
+ module Fastlane
4
+ module Actions
5
+ class BminfoAction < Action
6
+ def self.run(params)
7
+ environment = params[:environment]
8
+ self.project_func_get_information(environment: environment)
9
+ end
10
+
11
+ def self.description
12
+ "TODO"
13
+ end
14
+
15
+ def self.authors
16
+ ["Bemobile"]
17
+ end
18
+
19
+ def self.return_value
20
+ "TODO # If your method provides a return value, you can describe here what it does"
21
+ end
22
+
23
+ def self.details
24
+ "TODO"
25
+ end
26
+
27
+ def self.available_options
28
+ [
29
+ FastlaneCore::ConfigItem.new(key: :environment,
30
+ env_name: "ENVIRONMENT",
31
+ description: "The execution environment",
32
+ optional: false,
33
+ type: String)
34
+ ]
35
+ end
36
+
37
+ def self.is_supported?(platform)
38
+ true
39
+ end
40
+
41
+ def self.project_func_get_information(environment, ios_sign_config_type= "")
42
+
43
+ #Get android info
44
+ android_scheme_name = ENV["PRIVATE_ANDROID_SCHEME_NAME_DEV"]
45
+ android_bundle_id = ENV["PRIVATE_ANDROID_APP_ID_DEV"]
46
+ android_build_type = ENV["PRIVATE_ANDROID_BUILD_TYPE_DEV"]
47
+ if environment == Helper::BmHelper::CONST_PROJECT_ENVIRONMENT__PROD
48
+ android_scheme_name = ENV["PRIVATE_ANDROID_SCHEME_NAME_PROD"]
49
+ android_bundle_id = ENV["PRIVATE_ANDROID_APP_ID_PROD"]
50
+ android_build_type = ENV["PRIVATE_ANDROID_BUILD_TYPE_PROD"]
51
+ end
52
+
53
+ #Get ios scheme name
54
+ ios_scheme_name = ENV["PRIVATE_IOS_SCHEME_NAME_DEV"]
55
+ ios_bundle_id = ENV["PRIVATE_IOS_BUNDLE_ID_DEV"]
56
+ if environment == Helper::BmHelper::CONST_PROJECT_ENVIRONMENT__PROD
57
+ ios_scheme_name = ENV["PRIVATE_IOS_SCHEME_NAME_PROD"]
58
+ ios_bundle_id = ENV["PRIVATE_IOS_BUNDLE_ID_PROD"]
59
+ end
60
+
61
+ information = {
62
+ app_name: ENV["PRIVATE_APP_NAME"],
63
+ environment: environment,
64
+ changelog: ENV["PRIVATE_CHANGELOG"],
65
+
66
+ android: {
67
+ scheme_name: android_scheme_name,
68
+ bundle_id: android_bundle_id,
69
+ build_type: android_build_type, #DevRelease
70
+ },
71
+ ios: {
72
+ xcodeproj: ENV["PRIVATE_XCODEPROJ_NAME"],
73
+ workspace: ENV["PRIVATE_XCWORKSPACE_NAME"],
74
+ scheme_name: ios_scheme_name,
75
+ bundle_id: ios_bundle_id,
76
+ sign_config_type: ios_sign_config_type, # == match_type
77
+ }
78
+ }
79
+ information
80
+ end
81
+
82
+ end
83
+ end
84
+ end
@@ -5,11 +5,11 @@ module Fastlane
5
5
  class BmslackAction < Action
6
6
  def self.run(params)
7
7
  message_text = params[:message_text]
8
- is_exception = params[:is_exception]
8
+ is_exception = params[:is_exception] || false
9
9
  if is_exception
10
- self.slack_func_notify(message_text)
11
- else
12
10
  self.slack_func_notify_error_in_lane(message_text)
11
+ else
12
+ self.slack_func_notify(message_text)
13
13
  end
14
14
  UI.message("Message sent to Slack!")
15
15
  end
@@ -19,7 +19,7 @@ module Fastlane
19
19
  end
20
20
 
21
21
  def self.authors
22
- ["Erick, Legna @ Bemobile"]
22
+ ["Bemobile"]
23
23
  end
24
24
 
25
25
  def self.return_value
@@ -44,7 +44,7 @@ module Fastlane
44
44
  FastlaneCore::ConfigItem.new(key: :is_exception,
45
45
  env_name: "IS_EXCEPTION",
46
46
  description: "Flag that indicates if the message is from an exception",
47
- optional: false,
47
+ optional: true,
48
48
  type: Boolean)
49
49
  ]
50
50
  end
@@ -64,7 +64,7 @@ module Fastlane
64
64
 
65
65
 
66
66
  #Notify an error of the lane and show the error that fastlane has
67
- def slack_func_notify_error_in_lane(message_text)
67
+ def self.slack_func_notify_error_in_lane(message_text)
68
68
  payload = {
69
69
  "Build Date" => Time.new.to_s,
70
70
  "Error Message" => message_text
@@ -0,0 +1,58 @@
1
+ require 'fastlane/action'
2
+
3
+ module Fastlane
4
+ module Actions
5
+ class BmversionAction < Action
6
+ def self.run(params)
7
+ platform_type = params[:platform_type]
8
+ self.version_func_get_version(platform_type)
9
+ end
10
+
11
+ def self.description
12
+ "TODO"
13
+ end
14
+
15
+ def self.authors
16
+ ["Bemobile"]
17
+ end
18
+
19
+ def self.return_value
20
+ "TODO. If your method provides a return value, you can describe here what it does"
21
+ end
22
+
23
+ def self.details
24
+ "TODO"
25
+ end
26
+
27
+ def self.available_options
28
+ [
29
+ FastlaneCore::ConfigItem.new(key: :platform_type,
30
+ env_name: "PLATFORM_TYPE",
31
+ description: "The platform, can be Android or iOS",
32
+ optional: false,
33
+ type: String)
34
+ ]
35
+ end
36
+
37
+ def self.is_supported?(platform)
38
+ true
39
+ end
40
+
41
+ def self.version_func_get_version(platform_type)
42
+ build_number = ""
43
+ version_number = ""
44
+
45
+ if platform_type == Helper::BmHelper::CONST_PROJECT_TYPE__IOS
46
+ version_number = Actions.lane_context[Actions::SharedValues::VERSION_NUMBER]
47
+ build_number = Actions.lane_context[Actions::SharedValues::BUILD_NUMBER]
48
+ elsif
49
+ version_number = File.read("./../version.name").to_s
50
+ build_number = File.read("./../version.number").to_s
51
+ end
52
+
53
+ {build_number: build_number, version_number: version_number}
54
+ end
55
+
56
+ end
57
+ end
58
+ end
@@ -32,7 +32,7 @@ module Fastlane
32
32
  description: "The person's name",
33
33
  optional: false,
34
34
  type: String)
35
- ]
35
+ ]# If your method provides a return value, you can describe here what it does
36
36
  end
37
37
 
38
38
  def self.is_supported?(platform)
@@ -1,5 +1,4 @@
1
1
  require 'fastlane/action'
2
- require_relative '../helper/testbm_helper'
3
2
 
4
3
  module Fastlane
5
4
  module Actions
@@ -0,0 +1,44 @@
1
+ require 'fastlane_core/ui/ui'
2
+
3
+ module Fastlane
4
+ UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
5
+
6
+ module Helper
7
+ class BmHelper
8
+ # class methods that you define here become available in your action
9
+ # as `Helper::BmHelper.your_method`
10
+ #
11
+
12
+ CONST_PROJECT_TYPE__IOS = "IOS"
13
+ CONST_PROJECT_TYPE__ANDROID = "ANDROID"
14
+ CONST_PROJECT_TYPE__OTHER = "OTHER"
15
+
16
+ CONST_PROJECT_ENVIRONMENT__DEV = "dev"
17
+ CONST_PROJECT_ENVIRONMENT__PROD = "prod"
18
+
19
+ CONST_PLATFORM__IOS__SIGN_CONFIG_TYPE__DEVELOPMENT = "development"
20
+ CONST_PLATFORM__IOS__SIGN_CONFIG_TYPE__ADDHOC = "adhoc"
21
+ CONST_PLATFORM__IOS__SIGN_CONFIG_TYPE__APPSTORE = "appstore"
22
+
23
+ def self.show_message
24
+ UI.message("Hello from the testbm plugin helper!")
25
+ end
26
+
27
+ def self.version_func_get_version(platform_type)
28
+ build_number = ""
29
+ version_number = ""
30
+
31
+ if platform_type == Helper::BmHelper::CONST_PROJECT_TYPE__IOS
32
+ version_number = Actions.lane_context[Actions::SharedValues::VERSION_NUMBER]
33
+ build_number = Actions.lane_context[Actions::SharedValues::BUILD_NUMBER]
34
+ elsif
35
+ version_number = File.read("./../version.name").to_s
36
+ build_number = File.read("./../version.number").to_s
37
+ end
38
+
39
+ {build_number: build_number, version_number: version_number}
40
+ end
41
+
42
+ end
43
+ end
44
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Testbm
3
- VERSION = "0.1.15"
3
+ VERSION = "0.1.20"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-testbm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bemobile
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-19 00:00:00.000000000 Z
11
+ date: 2021-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -145,10 +145,13 @@ files:
145
145
  - LICENSE
146
146
  - README.md
147
147
  - lib/fastlane/plugin/testbm.rb
148
+ - lib/fastlane/plugin/testbm/actions/bmdistribution_action.rb
149
+ - lib/fastlane/plugin/testbm/actions/bminfo_action.rb
148
150
  - lib/fastlane/plugin/testbm/actions/bmslack_action.rb
151
+ - lib/fastlane/plugin/testbm/actions/bmversion_action.rb
149
152
  - lib/fastlane/plugin/testbm/actions/salutation_action.rb
150
153
  - lib/fastlane/plugin/testbm/actions/testbm_action.rb
151
- - lib/fastlane/plugin/testbm/helper/testbm_helper.rb
154
+ - lib/fastlane/plugin/testbm/helper/bm_helper.rb
152
155
  - lib/fastlane/plugin/testbm/version.rb
153
156
  homepage: https://github.com/eamedina87/fastlane-plugin-testbm
154
157
  licenses:
@@ -1,27 +0,0 @@
1
- require 'fastlane_core/ui/ui'
2
-
3
- module Fastlane
4
- UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
5
-
6
- module Helper
7
- class TestbmHelper
8
- # class methods that you define here become available in your action
9
- # as `Helper::TestbmHelper.your_method`
10
- #
11
- def self.show_message
12
- UI.message("Hello from the testbm plugin helper!")
13
- end
14
-
15
- #Notify via slack channel a generic message with the default payloads
16
- def self.slack_func_notify(message_text)
17
- other_action.slack(
18
- message: message_text,
19
- success: true,
20
- default_payloads: [:lane, :git_branch, :git_author],
21
- icon_url: ENV["SLACK_ICON"],
22
- username: "fastlane - #{ENV["PRIVATE_APP_NAME"]}")
23
- end
24
-
25
- end
26
- end
27
- end