fastlane-plugin-testbm 0.1.12 → 0.1.17

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: c6445b5dc1e8eaa98a6d15f9bd31231c4a0313c1a0d395807150c01442e89345
4
- data.tar.gz: ded217e7784b1704468304b7455902eec1741a1085c08fa0137988e3427f9a9a
3
+ metadata.gz: b99ffd24701ae3752dc4e842c790d7d34cbf845c41205352db592927e8241c18
4
+ data.tar.gz: cf88d0c3b38d1138c52dfed7c75f9d67a454e5ab3f37701504da1460ebf7775c
5
5
  SHA512:
6
- metadata.gz: 12305ef2e94518cfb2c88461af282db02fdc40eae870740aa1afed3d0de0c293f20573249944925d9250f19b65b0887642c6be16a414aad8f3586a6213447d64
7
- data.tar.gz: 41d428876a410aff8104a175d5f67f0c9d632204d7973974660a348dff06adc5801b255919009682ed78c6edd5877191707bd00d55a793a8a3dcb5a7dc45250c
6
+ metadata.gz: 8400a768dcd4ff2ee822962c4301bc49b24ca8e7b24855e82a94accae391b412229c139dd8bfaa81da6f05065f04366b2761aa371dd5e82d951db8eb7bd1522e
7
+ data.tar.gz: f26c19c94fede14e3dc5195678b31f54e8b13e0244bc3e424469c08e066336adc3f916f17b505c6717534a11f3fc6893b804115182493ee1ac84f67aaa1916dd
@@ -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
@@ -0,0 +1,84 @@
1
+ require 'fastlane/action'
2
+
3
+ module Fastlane
4
+ module Actions
5
+ class BmslackAction < Action
6
+ def self.run(params)
7
+ message_text = params[:message_text]
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
14
+ UI.message("Message sent to Slack!")
15
+ end
16
+
17
+ def self.description
18
+ "Sends a message to a Slack chat specified in the SLACK_URL environment variable"
19
+ end
20
+
21
+ def self.authors
22
+ ["Bemobile"]
23
+ end
24
+
25
+ def self.return_value
26
+ # If your method provides a return value, you can describe here what it does
27
+ end
28
+
29
+ def self.details
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.
32
+ An icon must be specified as a param named slack_icon, or as an environment variable named SLACK_ICON.
33
+ The webhook URL must be specified as an environment variable called SLACK_URL.
34
+ The username which sends the message can be appendend with the environment variable called PRIVATE_APP_NAME."
35
+ end
36
+
37
+ def self.available_options
38
+ [
39
+ FastlaneCore::ConfigItem.new(key: :message_text,
40
+ env_name: "MESSAGE_TEXT",
41
+ description: "The chat message to be sent to Slack",
42
+ optional: false,
43
+ 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)
49
+ ]
50
+ end
51
+
52
+ def self.is_supported?(platform)
53
+ true
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
+
82
+ end
83
+ end
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.12"
3
+ VERSION = "0.1.17"
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.12
4
+ version: 0.1.17
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/chat_action.rb
148
+ - lib/fastlane/plugin/testbm/actions/bmdistribution_action.rb
149
+ - lib/fastlane/plugin/testbm/actions/bminfo_action.rb
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,61 +0,0 @@
1
- require 'fastlane/action'
2
- require_relative '../helper/testbm_helper'
3
-
4
- module Fastlane
5
- module Actions
6
- class ChatAction < Action
7
- def self.run(params)
8
- slack_icon = params[:slack_icon]
9
- message_text = params[:message_text]
10
- other_action.slack(
11
- message: message_text,
12
- success: true,
13
- icon_url: slack_icon,
14
- username: "Bemobile Fastlane Plugin - #{ENV["PRIVATE_APP_NAME"]}"
15
- )
16
- Helper::TestbmHelper.slack_func_notify("Message from")
17
- UI.message("Message sent to Slack!")
18
- end
19
-
20
- def self.description
21
- "Returns hello world"
22
- end
23
-
24
- def self.authors
25
- ["Bemobile"]
26
- end
27
-
28
- def self.return_value
29
- # If your method provides a return value, you can describe here what it does
30
- end
31
-
32
- def self.details
33
- # Optional:
34
- "Just a test plugin"
35
- end
36
-
37
- def self.available_options
38
- [
39
- FastlaneCore::ConfigItem.new(key: :message_text,
40
- env_name: "MESSAGE_TEXT",
41
- description: "The chat message to be sent to Slack",
42
- optional: false,
43
- type: String),
44
- FastlaneCore::ConfigItem.new(key: :slack_icon,
45
- env_name: "SLACK_ICON",
46
- description: "The icon to be posted to Slack",
47
- optional: false,
48
- type: String)
49
- ]
50
- end
51
-
52
- def self.is_supported?(platform)
53
- # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
54
- # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
55
- #
56
- # [:ios, :mac, :android].include?(platform)
57
- true
58
- end
59
- end
60
- end
61
- end
@@ -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