Class: Fastlane::Actions::AppcenterCodepushReleaseReactAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



12
13
14
# File 'lib/fastlane/plugin/appcenter/actions/appcenter_codepush_release_react.rb', line 12

def self.authors
  ["Ivan Sokolovskii"]
end

.available_optionsObject



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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/fastlane/plugin/appcenter/actions/appcenter_codepush_release_react.rb', line 93

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :api_token,
                                type: String,
                            env_name: "APPCENTER_API_TOKEN",
                         description: "API Token for App Center Access",
                        verify_block: proc do |value|
                          UI.user_error!("No API token for App Center given, pass using `api_token: 'token'`") unless value && !value.empty?
                        end),
    FastlaneCore::ConfigItem.new(key: :owner_name,
                                type: String,
                            env_name: "APPCENTER_OWNER_NAME",
                         description: "Name of the owner of the application on App Center",
                        verify_block: proc do |value|
                          UI.user_error!("No owner name for App Center given, pass using `owner_name: 'owner name'`") unless value && !value.empty?
                        end),
    FastlaneCore::ConfigItem.new(key: :app_name,
                                type: String,
                            env_name: "APPCENTER_APP_NAME",
                         description: "Name of the application on App Center",
                        verify_block: proc do |value|
                          UI.user_error!("No app name for App Center given, pass using `app_name: 'app name'`") unless value && !value.empty?
                        end),
    FastlaneCore::ConfigItem.new(key: :deployment,
                                type: String,
                            env_name: "APPCENTER_CODEPUSH_DEPLOYMENT",
                            optional: true,
                       default_value: "Staging",
                         description: "Deployment name for releasing to"),
    FastlaneCore::ConfigItem.new(key: :target_version,
                                type: String,
                            env_name: "APPCENTER_CODEPUSH_TARGET_VERSION",
                            optional: true,
                         description: "Target binary version for example 1.0.1"),
    FastlaneCore::ConfigItem.new(key: :mandatory,
                                type: Boolean,
                            env_name: "APPCENTER_CODEPUSH_MANDATORY",
                       default_value: true,
                            optional: true,
                         description: "mandatory update or not"),
    FastlaneCore::ConfigItem.new(key: :description,
                                type: String,
                            env_name: "APPCENTER_CODEPUSH_DESCRIPTION",
                            optional: true,
                         description: "Release description for CodePush"),
    FastlaneCore::ConfigItem.new(key: :dry_run,
                                type: Boolean,
                            env_name: "APPCENTER_CODEPUSH_DRY_RUN",
                       default_value: false,
                            optional: true,
                         description: "Print the command that would be run, and don't run it"),
    FastlaneCore::ConfigItem.new(key: :disabled,
                                type: Boolean,
                            env_name: "APPCENTER_CODEPUSH_DISABLED",
                       default_value: false,
                            optional: true,
                         description: "Specifies whether this release should be immediately downloadable"),
    FastlaneCore::ConfigItem.new(key: :no_duplicate_release_error,
                                type: Boolean,
                            env_name: "APPCENTER_CODEPUSH_NO_DUPLICATE_ERROR",
                       default_value: false,
                            optional: true,
                         description: "Specifies whether to return an error if the main bundle is identical to the latest codepush release"),
    FastlaneCore::ConfigItem.new(key: :bundle_name,
                                type: String,
                            env_name: "APPCENTER_CODEPUSH_BUNDLE_NAME",
                            optional: true,
                         description: "Specifies the name of the bundle file"),
    FastlaneCore::ConfigItem.new(key: :output_dir,
                                type: String,
                            env_name: "APPCENTER_CODEPUSH_OUTPUT",
                            optional: true,
                         description: "Specifies path to where the bundle and sourcemap should be written"),
    FastlaneCore::ConfigItem.new(key: :sourcemap_output,
                                type: String,
                            env_name: "APPCENTER_CODEPUSH_SOURCEMAP_OUTPUT",
                            optional: true,
                         description: "Specifies path to write sourcemap to"),
    FastlaneCore::ConfigItem.new(key: :development,
                                type: Boolean,
                            env_name: "APPCENTER_CODEPUSH_DEVELOPMENT",
                            optional: true,
                       default_value: false,
                         description: "Specifies whether to generate a dev build"),
    FastlaneCore::ConfigItem.new(key: :use_local_appcenter_cli,
                                type: Boolean,
                            env_name: "APPCENTER_CODEPUSH_USE_LOCAL_APPCENTER_CLI",
                            optional: true,
                       default_value: false,
                         description: "When true, the appcenter cli installed in the project directory is used"),
    FastlaneCore::ConfigItem.new(key: :plist_file,
                                type: String,
                            env_name: "APPCENTER_CODEPUSH_PLIST_FILE",
                            optional: true,
                         description: "Path to the Info.plist"),
    FastlaneCore::ConfigItem.new(key: :xcode_project_file,
                                type: String,
                            env_name: "APPCENTER_CODEPUSH_XCODE_PROJECT_FILE",
                            optional: true,
                         description: "Path to the .pbxproj file"),
    FastlaneCore::ConfigItem.new(key: :private_key_path,
                                type: String,
                            env_name: "APPCENTER_CODEPUSH_PRIVATE_KEY_PATH",
                            optional: true,
                         description: "Path to private key that will be used for signing bundles"),
    FastlaneCore::ConfigItem.new(key: :use_hermes,
                                type: Boolean,
                            env_name: "APPCENTER_CODEPUSH_USE_HERMES",
                            optional: true,
                         description: "Enable hermes and bypass automatic checks"),
    FastlaneCore::ConfigItem.new(key: :extra_bundler_options,
                                type: Array,
                            env_name: "APPCENTER_CODEPUSH_EXTRA_BUNDLER_OPTIONS",
                            optional: true,
                         description: "Options that get passed to the react-native bundler"),
  ]
end

.descriptionObject



8
9
10
# File 'lib/fastlane/plugin/appcenter/actions/appcenter_codepush_release_react.rb', line 8

def self.description
  "CodePush release react action"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


211
212
213
# File 'lib/fastlane/plugin/appcenter/actions/appcenter_codepush_release_react.rb', line 211

def self.is_supported?(platform)
  [:ios, :android].include?(platform)
end

.run(params) ⇒ Object



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
91
# File 'lib/fastlane/plugin/appcenter/actions/appcenter_codepush_release_react.rb', line 16

def self.run(params)
  app = params[:app_name]
  owner = params[:owner_name]
  token = params[:api_token]
  deployment = params[:deployment]
  dev = params[:development]
  description = params[:description]
  mandatory = params[:mandatory]
  version = params[:target_version]
  disabled = params[:disabled]
  no_errors = params[:no_duplicate_release_error]
  bundle = params[:bundle_name]
  output = params[:output_dir]
  sourcemap_output = params[:sourcemap_output]
  private_key_path = params[:private_key_path]
  dry_run = params[:dry_run]
  use_local_appcenter_cli = params[:use_local_appcenter_cli]
  plist_file = params[:plist_file]
  xcode_project_file = params[:xcode_project_file]
  use_hermes = params[:use_hermes]
  extra_bundler_options = params[:extra_bundler_options]

  base_executable = "appcenter "

  if use_local_appcenter_cli
    base_executable = "npm exec -- " + base_executable
  end

  command = base_executable + "codepush release-react --token #{token} --app #{owner}/#{app} --deployment-name #{deployment} --development #{dev} "

  if description
    command += "--description \"#{description}\" "
  end
  if mandatory
    command += "--mandatory "
  end
  if version
    command += "--target-binary-version #{version} "
  end
  if disabled
    command += "--disabled "
  end
  if no_errors
    command += "--disable-duplicate-release-error "
  end
  if bundle
    command += "--bundle-name #{bundle} "
  end
  if output
    command += "--output-dir #{output} "
  end
  if sourcemap_output
    command += "--sourcemap-output #{sourcemap_output} "
  end
  if private_key_path
    command += "--private-key-path #{private_key_path} "
  end
  if plist_file
    command += "--plist-file #{plist_file} "
  end
  if xcode_project_file
    command += "--xcode-project-file #{xcode_project_file} "
  end
  unless use_hermes.nil?
    command += "--use-hermes #{use_hermes} "
  end
  if extra_bundler_options
    command += extra_bundler_options.map { |option| "--extra-bundler-option='#{option}' " }.join
  end

  if dry_run
    UI.message("Dry run!".red + " Would have run: " + command + "\n")
  else
    sh(command.to_s)
  end
end