fastlane-plugin-testbm 0.1.13 → 0.1.18

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: 8d51ae44fdcb2eb4ce01781ae9c112d19e331c678eddf087af0907aeda972035
4
- data.tar.gz: 1960915e2f76f09aeea0655688e13a639a79d20d9ee74969307b11da5ba71542
3
+ metadata.gz: 15c37951fa9fda3533d239231f9f3e47e94862fb87c19357c3e44fe85e9e3237
4
+ data.tar.gz: 62d636bdbf266665958a4f56a44956e8f3d7535c45703c0b9fb1673b0670a1e7
5
5
  SHA512:
6
- metadata.gz: 258ce81e49b7177aade18b043cd21245f24126193236c07d295e077637d4753e9deaedbbd7a05db5676fb11178b4658eb88d7edda2630ea35b9538ddadd44149
7
- data.tar.gz: b45d94f896700da2ccaab3f7d10aff039ad14f067bb1998de7396b5c9e02d14999f7ae2cf379910bf46c899b8a63faf295102d7cf718da15ed6a31545f54674a
6
+ metadata.gz: 5050e46ceffb8c1f2475951e49e1632f7ef1b1345c01054a050ead0252ee526186f26d61fce741599c20fcc519b561ff1022663a52b964cff14befa6de62c08b
7
+ data.tar.gz: 43135168f8636f2f273d22c18b90bf3ee31cac52ecff2c62bd3dc3c41f94060dbc9c478d7301b6394694a7dd098b951502e61a39467b89f4816ae8efd85bcaa8
@@ -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
@@ -4,24 +4,22 @@ module Fastlane
4
4
  module Actions
5
5
  class BmslackAction < Action
6
6
  def self.run(params)
7
- slack_icon = params[:slack_icon]
8
7
  message_text = params[:message_text]
9
- other_action.slack(
10
- message: message_text,
11
- success: true,
12
- icon_url: slack_icon,
13
- default_payloads: [:lane, :git_branch, :git_author],
14
- username: "Bemobile Fastlane Plugin - #{ENV["PRIVATE_APP_NAME"]}"
15
- )
8
+ is_exception = params[:is_exception] || false
9
+ if is_exception
10
+ self.slack_func_notify_error_in_lane(message_text)
11
+ else
12
+ self.slack_func_notify(message_text)
13
+ end
16
14
  UI.message("Message sent to Slack!")
17
15
  end
18
16
 
19
17
  def self.description
20
- "Sends a message to a Slack chat specified in the SLACK_URL environment variable."
18
+ "Sends a message to a Slack chat specified in the SLACK_URL environment variable"
21
19
  end
22
20
 
23
21
  def self.authors
24
- ["Erick, Legna @ Bemobile."]
22
+ ["Bemobile"]
25
23
  end
26
24
 
27
25
  def self.return_value
@@ -30,6 +28,7 @@ module Fastlane
30
28
 
31
29
  def self.details
32
30
  "Sends a message to a Slack webhook. The message must be passed to the function as a parameter named message_text.
31
+ To specify that the message comes from an exception or not, we must pass the is_exception parameter.
33
32
  An icon must be specified as a param named slack_icon, or as an environment variable named SLACK_ICON.
34
33
  The webhook URL must be specified as an environment variable called SLACK_URL.
35
34
  The username which sends the message can be appendend with the environment variable called PRIVATE_APP_NAME."
@@ -42,17 +41,44 @@ module Fastlane
42
41
  description: "The chat message to be sent to Slack",
43
42
  optional: false,
44
43
  type: String),
45
- FastlaneCore::ConfigItem.new(key: :slack_icon,
46
- env_name: "SLACK_ICON",
47
- description: "The user icon to be posted to Slack",
48
- optional: false,
49
- type: String)
44
+ FastlaneCore::ConfigItem.new(key: :is_exception,
45
+ env_name: "IS_EXCEPTION",
46
+ description: "Flag that indicates if the message is from an exception",
47
+ optional: true,
48
+ type: Boolean)
50
49
  ]
51
50
  end
52
51
 
53
52
  def self.is_supported?(platform)
54
53
  true
55
54
  end
55
+
56
+ def self.slack_func_notify(message_text)
57
+ other_action.slack(
58
+ message: message_text,
59
+ success: true,
60
+ default_payloads: [:lane, :git_branch, :git_author],
61
+ icon_url: ENV["SLACK_ICON"],
62
+ username: "Bemobile Fastlane Plugin - #{ENV["PRIVATE_APP_NAME"]}")
63
+ end
64
+
65
+
66
+ #Notify an error of the lane and show the error that fastlane has
67
+ def self.slack_func_notify_error_in_lane(message_text)
68
+ payload = {
69
+ "Build Date" => Time.new.to_s,
70
+ "Error Message" => message_text
71
+ }
72
+
73
+ other_action.slack(
74
+ message: "#{ENV["PRIVATE_APP_NAME"]} App build stop with error",
75
+ success: false,
76
+ icon_url: ENV["SLACK_ICON"],
77
+ username: "Bemobile Fastlane Plugin - #{ENV["PRIVATE_APP_NAME"]}",
78
+ payload: payload)
79
+
80
+ end
81
+
56
82
  end
57
83
  end
58
84
  end
@@ -0,0 +1,57 @@
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
+ end
35
+
36
+ def self.is_supported?(platform)
37
+ true
38
+ end
39
+
40
+ def self.version_func_get_version(platform_type)
41
+ build_number = ""
42
+ version_number = ""
43
+
44
+ if platform_type == Helper::BmHelper::CONST_PROJECT_TYPE__IOS
45
+ version_number = Actions.lane_context[Actions::SharedValues::VERSION_NUMBER]
46
+ build_number = Actions.lane_context[Actions::SharedValues::BUILD_NUMBER]
47
+ elsif
48
+ version_number = File.read("./../version.name").to_s
49
+ build_number = File.read("./../version.number").to_s
50
+ end
51
+
52
+ {build_number: build_number, version_number: version_number}
53
+ end
54
+
55
+ end
56
+ end
57
+ end
@@ -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.13"
3
+ VERSION = "0.1.18"
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.13
4
+ version: 0.1.18
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