Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ The functionallity is currently limited to the options described below. The plug
https://github.com/Microsoft/code-push/blob/master/cli/README.md#access-keys

```
code_push_login(access_key: YOURSECRETACCESSKEY)
code_push_login(token: YOURSECRETACCESSKEY)
```
Options:

Key | Description | Env Var | Default
------------- | ------------- | ------------- | -------------
access_key | Access Key for CodePush Login | CODE_PUSH_ACCESS_KEY |
token | Access Key for CodePush Login | APP_CENTER_ACCESS_TOKEN |
enforce | Enforce logout before login | | false

"enforce" is usefull if you want to be assure that actions are done by a specfic "user" and not by the may current logged in user. Like in the context of a automatic build process
Expand All @@ -44,7 +44,7 @@ Options:

Key | Description | Env Var | Default
------------- | ------------- | ------------- | -------------
app_name | CodePush app name for promoting to | FASTLANE_CODE_PUSH_APP_NAME |
app_name | CodePush app name for promoting to | FASTLANE_APPCENTER_APP_NAME |
from | sourceDeploymentName | | Staging
to | destDeploymentName | | Production
dry_run | Print the command that would be run, and don't run it | | false
Expand All @@ -62,7 +62,7 @@ code_push_release_cordova(

Key | Description | Env Var | Default
------------- | ------------- | ------------- | -------------
app_name | CodePush app name for releasing | FASTLANE_CODE_PUSH_APP_NAME |
app_name | CodePush app name for releasing | FASTLANE_APPCENTER_APP_NAME |
execution_dir_path | Release React CLI command execution dir path. Set to project root when you execute fastlane in a diffrent dir than package.json stays | | ./
platform | Platform for releasing to | | android
deployment | Deployment name for releasing to | | Staging
Expand All @@ -85,9 +85,8 @@ code_push_release_react(

Key | Description | Env Var | Default
------------- | ------------- | ------------- | -------------
app_name | CodePush app name for releasing | FASTLANE_CODE_PUSH_APP_NAME |
app_name | CodePush app name for releasing | FASTLANE_APPCENTER_APP_NAME |
execution_dir_path | Release React CLI command execution dir path. Set to project root when you execute fastlane in a diffrent dir than package.json stays | | ./
platform | Platform for releasing to | | android
deployment | Deployment name for releasing to | | Staging
target_binary_version | Target binary version for example 1.0.1 | |
mandatory | manadtory update or not | | true
Expand Down
16 changes: 8 additions & 8 deletions lib/fastlane/plugin/code_push/actions/code_push_login_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ def self.run(params)
Helper::CodePushLoginHelper.log_out
end
if Helper::CodePushLoginHelper.is_logged_in == false
if params[:access_key].instance_of?(String)
Helper::CodePushLoginHelper.log_in(params[:access_key])
if params[:token].instance_of?(String)
Helper::CodePushLoginHelper.log_in(params[:token])
else
UI.user_error!("Provide parameter :access_key String")
UI.user_error!("Provide parameter :token String")
end
else
UI.important "Login skipped !!! You were allready logged in. Logout first "
end
end

def self.description
"CodePush login with accessKey"
"AppCenter login with accessKey"
end

def self.authors
["Manuel Koch"]
["Manuel Koch", "Hannan Shaik"]
end

def self.return_value
Expand All @@ -35,11 +35,11 @@ def self.details

def self.available_options
[
FastlaneCore::ConfigItem.new(key: :access_key,
env_name: "CODE_PUSH_ACCESS_KEY",
FastlaneCore::ConfigItem.new(key: :token,
env_name: "APP_CENTER_ACCESS_TOKEN",
type: String,
optional: false,
description: "Access Key for CodePush Login"),
description: "Access Key for AppCenter Login"),
FastlaneCore::ConfigItem.new(key: :enforce,
type: TrueClass,
optional: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Fastlane
module Actions
class CodePushPromoteAction < Action
def self.run(params)
command = "code-push promote #{params[:app_name]} #{params[:from]} #{params[:to]}"
command = "appcenter codepush promote -a #{params[:app_name]} -s #{params[:from]} -d #{params[:to]}"
if params[:dry_run]
UI.message("Dry run!".red + " Would have run: " + command + "\n")
else
Expand All @@ -15,7 +15,7 @@ def self.description
end

def self.authors
["Manuel Koch"]
["Manuel Koch", "Hannan Shaik"]
end

def self.return_value
Expand All @@ -28,7 +28,7 @@ def self.details
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :app_name,
env_name: "FASTLANE_CODE_PUSH_APP_NAME",
env_name: "FASTLANE_APPCENTER_APP_NAME",
type: String,
optional: false,
description: "CodePush app name for promoting to"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module Actions
class CodePushReleaseCordovaAction < Action
def self.run(params)
Dir.chdir "#{params[:execution_dir_path]}" do
command = "code-push release-cordova #{params[:app_name]} #{params[:platform]} -d #{params[:deployment]} "\
"--des \"#{params[:description]}\" "
command = "appcenter codepush release-cordova -a #{params[:app_name]} -d #{params[:deployment]} "\
"--description \"#{params[:description]}\" "
if params[:mandatory]
command += "-m "
end
Expand Down Expand Up @@ -42,7 +42,7 @@ def self.details
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :app_name,
env_name: "FASTLANE_CODE_PUSH_APP_NAME",
env_name: "FASTLANE_APPCENTER_APP_NAME",
type: String,
optional: false,
description: "CodePush app name for releasing"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module Actions
class CodePushReleaseReactAction < Action
def self.run(params)
Dir.chdir "#{params[:execution_dir_path]}" do
command = "code-push release-react #{params[:app_name]} #{params[:platform]} -d #{params[:deployment]} "\
"--des \"#{params[:description]}\" "
command = "appcenter codepush release-react -a #{params[:app_name]} -d #{params[:deployment]} "\
"--description \"#{params[:description]}\" "
if params[:mandatory]
command += "-m "
end
Expand Down Expand Up @@ -39,7 +39,7 @@ def self.description
end

def self.authors
["Manuel Koch"]
["Manuel Koch", "Hannan Shaik"]
end

def self.return_value
Expand All @@ -54,7 +54,7 @@ def self.details
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :app_name,
env_name: "FASTLANE_CODE_PUSH_APP_NAME",
env_name: "FASTLANE_APPCENTER_APP_NAME",
type: String,
optional: false,
description: "CodePush app name for releasing"),
Expand All @@ -63,11 +63,6 @@ def self.available_options
optional: true,
default_value: "./",
description: "Release React CLI command execution dir"),
FastlaneCore::ConfigItem.new(key: :platform,
type: String,
optional: true,
default_value: "android",
description: "Platform for releasing to"),
FastlaneCore::ConfigItem.new(key: :deployment,
type: String,
optional: true,
Expand Down
10 changes: 5 additions & 5 deletions lib/fastlane/plugin/code_push/helper/code_push_login_helper.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
module Fastlane
module Helper
class CodePushLoginHelper
def self.log_in(access_key)
Action.sh("code-push login --accessKey #{access_key}", print_command: false)
def self.log_in(token)
Action.sh("appcenter login --token #{token}", print_command: false)
rescue
UI.user_error!("something went wrong during login with access key #{access_key}")
UI.user_error!("something went wrong during login with access key #{token}")
end
def self.log_out
Action.sh("code-push logout")
Action.sh("appcenter logout")
rescue
end

def self.is_logged_in
value = true
begin
Action.sh("code-push whoami", false)
Action.sh("appcenter whoami", false)
rescue
value = false
end
Expand Down