Class: Fastlane::Actions::GsExecuteRcLaneAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/gs_project_flow_ios/actions/gs_execute_rc_lane.rb

Class Method Summary collapse

Class Method Details

.authorsObject



141
142
143
# File 'lib/fastlane/plugin/gs_project_flow_ios/actions/gs_execute_rc_lane.rb', line 141

def self.authors
  ["Сергей Веселовский"]
end

.available_optionsObject



154
155
156
157
158
159
160
161
162
# File 'lib/fastlane/plugin/gs_project_flow_ios/actions/gs_execute_rc_lane.rb', line 154

def self.available_options
  [
      FastlaneCore::ConfigItem.new(key: :alias,
                                   env_name: "ALIAS",
                                   description: "project system alias",
                                   optional: false,
                                   type: String)
  ]
end

.descriptionObject



137
138
139
# File 'lib/fastlane/plugin/gs_project_flow_ios/actions/gs_execute_rc_lane.rb', line 137

def self.description
  "Plugin contains project flow code for code sharing between projects"
end

.detailsObject



149
150
151
152
# File 'lib/fastlane/plugin/gs_project_flow_ios/actions/gs_execute_rc_lane.rb', line 149

def self.details
  # Optional:
  "Plugin contains project flow code for code sharing between GradoService projects"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


164
165
166
167
168
169
170
# File 'lib/fastlane/plugin/gs_project_flow_ios/actions/gs_execute_rc_lane.rb', line 164

def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
  #
  # [:ios, :mac, :android].include?(platform)
  true
end

.moveToReview(version) ⇒ Object



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/fastlane/plugin/gs_project_flow_ios/actions/gs_execute_rc_lane.rb', line 93

def self.moveToReview(version)
  s = Actions::GsGetAppStatusAction.run(FastlaneCore::Configuration.create(GsGetAppStatusAction.available_options, {app_identifier: ENV["BUNDLE_ID"]}))
  arg = FastlaneCore::Configuration.create(GsIncrementReleaseVersionAction.available_options, {path: Helper::GsProjectFlowIosHelper.get_versions_path})
  v = GsIncrementReleaseVersionAction.run(arg)
  # match(type: "appstore")
  # snapshot
  version_name = v.major.to_s + "." + v.minor.to_s

  # generateReleaseNotes("fileClosed", ENV["ALIAS"], version_name, "Ru")
  # generateReleaseNotes("fileClosed", ENV["ALIAS"], version_name, "En")

  ruText = Helper::FileHelper.read(Dir.pwd + "/../../notes/" + ENV["ALIAS"] + "/" + version_name + "_Ru.txt")
  enText = Helper::FileHelper.read(Dir.pwd + "/../../notes/" + ENV["ALIAS"] + "/" + version_name + "_En.txt")
  Helper::FileHelper.write(Dir.pwd+'/fastlane/metadata/ru/release_notes.txt', ruText)
  Helper::FileHelper.write(Dir.pwd+'/fastlane/metadata/en-US/release_notes.txt', enText)
  # gym(scheme: ENV["APP_SCHEME"]) # Build your app - more options available
  if s == "Waiting For Review" || s == "Pending Developer Release"
    Actions::GsRejectLatestVersionAction.run(FastlaneCore::Configuration.create(GsRejectLatestVersionAction.available_options, {app_identifier: ENV["BUNDLE_ID"]}))
  end
  Actions::DeliverAction.run(FastlaneCore::Configuration.create(DeliverAction.available_options, {force: true,
                                                                                                  submit_for_review: true,
                                                                                                  app_version: version,
                                                                                                  skip_binary_upload: true,
                                                                                                  automatic_release: false,
                                                                                                  submission_information: {
                                                                                                      add_id_info_limits_tracking: ENV["LIMITS_TRACKING"], #в данном приложении, а также в любом связанном с ним стороннем сервисе используется проверка рекламного идентификатора и применяются пользовательские настройки ограничения трекинга рекламы в iOS.
                                                                                                      add_id_info_serves_ads: ENV["IS_ADS_IN_APP_IDFA"], #Размещение рекламы в приложении
                                                                                                      add_id_info_tracks_action: ENV["TRACKS_USER_ACTIONS_IDFA"], # определения связи между действиями пользователя внутри приложения и ранее размещенной рекламой.
                                                                                                      add_id_info_tracks_install: ENV["TRACKS_INSTALL_IDFA"], # определения связи между установкой приложения и ранее размещенной рекламой;
                                                                                                      add_id_info_uses_idfa: ENV["USES_IDFA"], #В приложении используется рекламный идентификатор (IDFA)?
                                                                                                      content_rights_has_rights: true,
                                                                                                      content_rights_contains_third_party_content: false,
                                                                                                      export_compliance_platform: 'ios',
                                                                                                      export_compliance_compliance_required: false,
                                                                                                      export_compliance_encryption_updated: false,
                                                                                                      export_compliance_uses_encryption: ENV["USES_ENCRYPTION"],
                                                                                                      export_compliance_is_exempt: false,
                                                                                                      export_compliance_contains_third_party_cryptography: false,
                                                                                                      export_compliance_contains_proprietary_cryptography: false,
                                                                                                      export_compliance_available_on_french_store: true
                                                                                                  }}))
end

.return_valueObject



145
146
147
# File 'lib/fastlane/plugin/gs_project_flow_ios/actions/gs_execute_rc_lane.rb', line 145

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/fastlane/plugin/gs_project_flow_ios/actions/gs_execute_rc_lane.rb', line 4

def self.run(params)
  require 'fastlane/plugin/gs_versioning'
  require 'fastlane/plugin/versioning'
  ENV['RC_DID_FAILED'] = 'true'

  fastlaneHelper = Fastlane::Helper::GsProjectFlowIosHelper.new
  arg = FastlaneCore::Configuration.create(GsIncrementRcVersionAction.available_options, {path: Helper::GsProjectFlowIosHelper.get_versions_path})
  v = GsIncrementRcVersionAction.run(arg)
  version_name = v.major.to_s + "." + v.minor.to_s + "." + v.build.to_s
  UI.message('version' + version_name)

  plist_path = Actions::GetInfoPlistPathAction.run(FastlaneCore::Configuration.create(GetInfoPlistPathAction.available_options, {xcodeproj: ENV["xcodeproj"],
                                                                                                                                 target: ENV["target"]}))
  Actions::SetInfoPlistValueAction.run(FastlaneCore::Configuration.create(SetInfoPlistValueAction.available_options, {path: plist_path, key: "ITSAppUsesNonExemptEncryption", value: "false"}))

  Actions::IncrementBuildNumberInPlistAction.run(FastlaneCore::Configuration.create(Actions::IncrementBuildNumberInPlistAction.available_options,
                                                                                    {xcodeproj: ENV["xcodeproj"], target: ENV["target"], build_number: v.build.to_s}))

  Actions::IncrementVersionNumberInPlistAction.run(FastlaneCore::Configuration.create(Actions::IncrementVersionNumberInPlistAction.available_options,
                                                                                      {version_number: v.major.to_s + "." + v.minor.to_s, xcodeproj: ENV["xcodeproj"], target: ENV["target"]}))

  ruText = fastlaneHelper.generateReleaseNotes("fileClosed", params[:alias], v.major.to_s + "." + v.minor.to_s, "Ru")
  enText = fastlaneHelper.generateReleaseNotes("fileClosed", params[:alias], v.major.to_s + "." + v.minor.to_s, "En")

  # ruText = FileHelper.read(Dir.pwd + "/../../../notes/" + ENV["ALIAS"] + "/" + version_name + "_Ru.txt")
  # enText = FileHelper.read(Dir.pwd + "/../../../notes/" + ENV["ALIAS"] + "/" + version_name + "_En.txt")
  testflight_changelog = ruText + "\n\n" + enText
  UI.message("changelog = " + testflight_changelog)

  appDescription = Helper::FileHelper.read (Dir.pwd + "/fastlane/metadata/ru/description.txt")


  options = {changelog: testflight_changelog,
             beta_app_description: appDescription,
             distribute_external: false,
             beta_app_feedback_email: "[email protected]"}

  # Dir.chdir ".." do
  sh "chmod 744 ./DeleteDerrivedData.sh"
  sh Dir.pwd+"/DeleteDerrivedData.sh"
  # end
  Actions::GymAction.run(FastlaneCore::Configuration.create(GymAction.available_options, {silent: true,
                                                                                          scheme: ENV["APP_SCHEME"],
                                                                                          export_method: "app-store",
                                                                                          export_options: {provisioningProfiles: {ENV["BUNDLE_ID"] => "AppStore "+ENV["ALIAS"]}},
                                                                                          clean: true,
                                                                                          suppress_xcode_output: true
  })) # Build your app - more options available
  s = Actions::GsGetAppStatusAction.run(FastlaneCore::Configuration.create(GsGetAppStatusAction.available_options, {app_identifier: ENV["BUNDLE_ID"]}))
  if s == "Pending Developer Release"
    Actions::GsRejectLatestVersionAction.run(FastlaneCore::Configuration.create(GsRejectLatestVersionAction.available_options, {app_identifier: ENV["BUNDLE_ID"]}))
  end
  cmd = "mv2rc"
  version_for_back = v.major.to_s + "." + v.minor.to_s
  bot_options = {
      cmd:cmd,
      displayVersionName:version_for_back,
      buildNumber:v.build,
      request: "cmd",
      alias: ENV["ALIAS"]
  }
  Actions::GsExecuteCommandAction.run(FastlaneCore::Configuration.create(GsExecuteCommandAction.available_options,bot_options))
  Actions::PilotAction.run(FastlaneCore::Configuration.create(PilotAction.available_options, options))
  UI.success("App is released to internal testing")

  Actions::GsSaveRcVersionAction.run(FastlaneCore::Configuration.create(GsSaveRcVersionAction.available_options, {version: v, path: Helper::GsProjectFlowIosHelper.get_versions_path}))
  ENV['RC_DID_FAILED'] = 'false'

  # version_name = "3" + "." + "5" + "." + "5"

  Actions::GsExecuteRcLaneAction.moveToReview(version_name)
  UI.success("✅ App status is changed to Waiting For Review")
  options[:distribute_external] = true
  # options[:review_contact_info] = {
  #     review_first_name: "MyTestAccount",
  #     review_last_name: "MyTestAccount",
  #     review_phone_number: "88432000555",
  #     review_contact_email: "[email protected]",
  # }
  begin
    Actions::GsMoveRcToBetaReviewAction.run(FastlaneCore::Configuration.create(GsMoveRcToBetaReviewAction.available_options,
                                                                               options))
    UI.success("App is moved to beta review for external testing")
  rescue Exception => e
    UI.important(e.message)
  end
end