fastlane-plugin-testbm 0.1.16 → 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: db9746f941149335d720d7d106e38a3bbcf534f86d5dbd8683352f07f90c8122
4
- data.tar.gz: 1d0ad2a7a1209b82c38fd2e405f4f0dcb589f96367f214ee23f74eab823588d0
3
+ metadata.gz: b99ffd24701ae3752dc4e842c790d7d34cbf845c41205352db592927e8241c18
4
+ data.tar.gz: cf88d0c3b38d1138c52dfed7c75f9d67a454e5ab3f37701504da1460ebf7775c
5
5
  SHA512:
6
- metadata.gz: c1ff7d907e1b2bed479d5e309111446d507d3b44e04e700f16f84a0167fdff4029d4d85089f826267e22665d639eb37f3fb4df0ce701d25ce89f76d392423293
7
- data.tar.gz: 299d573260bfdaa081250a44ecd4c54b00aed962bd2f0380ea7e19c5c74c42e010c118355a1d19416af2a306b7568c099f69e1430aad93f2476e09669c693a49
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
@@ -5,7 +5,7 @@ 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
10
  self.slack_func_notify_error_in_lane(message_text)
11
11
  else
@@ -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
@@ -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.16"
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.16
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/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