fastlane-plugin-applivery 1.1.2 → 2.2.2
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
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dfa26aff66362f56dc480a7bd926f480f1862c7408ef3765a54e2ad994e0e197
|
4
|
+
data.tar.gz: 3e78dac7b40ad0d8d52b17addcade452e2e9c37fc1ce095e79e16696c69c668f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79946dcc62b82f09f909dd25b241c784d919512c66b58ba55a02d6191af343a1e01a911c32d0a2a1ba937f67fb457c123fb230cd867a6b3ffbc9aae25e65ce06
|
7
|
+
data.tar.gz: e54b6e47a3500d5195b1f184c43ec5cbe620e1b4ebe1de61fd12d5acf501163b248931ed4ec9de4a6e66ab368507b75a6de1db314ade179072914f3730bf6ab7
|
data/README.md
CHANGED
@@ -30,43 +30,66 @@ Below you'll find some basic examples about how to **build** a new iOS or Androi
|
|
30
30
|
|
31
31
|
### iOS App build and deploy
|
32
32
|
Next you'll find a `lane` with two steps: `gym()` that will build the iOS App and `applivery()` that will take care about the deployment.
|
33
|
+
|
33
34
|
```ruby
|
34
35
|
lane :applivery_ios do
|
35
36
|
gym(
|
36
37
|
scheme: "YOUR_APP_SCHEME", # Your App Scheme
|
37
|
-
export_method: 'enterprise') # Choose between: enterprise or ad-hoc
|
38
|
+
export_method: 'enterprise') # Choose between: enterprise or ad-hoc`
|
38
39
|
applivery(
|
39
|
-
|
40
|
-
api_key: "YOUR_API_KEY" # Your Applivery API Key
|
41
|
-
)
|
40
|
+
app_token: "YOUR_APP_TOKEN") # Your Applivery App Token
|
42
41
|
end
|
43
42
|
```
|
43
|
+
|
44
44
|
### Android App build and deploy
|
45
45
|
Next you'll find a `lane` with two steps: `gradle()` that will build the Android App and `applivery()` that will take care about the deployment.
|
46
|
+
|
46
47
|
```ruby
|
47
48
|
lane :applivery_android do
|
48
49
|
gradle(task: "assembleRelease")
|
49
50
|
applivery(
|
50
|
-
|
51
|
-
api_key: "YOUR_API_KEY" # Your Applivery API Key
|
52
|
-
)
|
51
|
+
app_token: "YOUR_APP_TOKEN") # Your Applivery App Token
|
53
52
|
end
|
54
53
|
```
|
54
|
+
|
55
55
|
Please check out the [example `Fastfile`](fastlane/Fastfile) to see additional examples of how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
|
56
56
|
|
57
57
|
## Additional Parameters
|
58
|
-
The above examples are the most simple configuration you can have but
|
59
|
-
|
60
|
-
| Param
|
61
|
-
|
62
|
-
| `
|
63
|
-
| `
|
64
|
-
| `
|
65
|
-
| `
|
66
|
-
| `
|
67
|
-
| `
|
68
|
-
| `
|
69
|
-
| `
|
58
|
+
The above examples are the most simple configuration you can have but you can add additional parameters to fully customize the deployment process. They are:
|
59
|
+
|
60
|
+
| Param | Description | Mandatory | Values |
|
61
|
+
|--------------------------|--------------------------------------|-----------|--------------|
|
62
|
+
| `app_token` | Applivery App Token | YES | string -> Available in the App Settings |
|
63
|
+
| `name` | Applivery Build name | NO | string-> i.e.: "RC 1.0" |
|
64
|
+
| `notify_collaborators` | Notify Collaborators after deploy | NO | booletan -> i.e.: `true` / `false` |
|
65
|
+
| `notify_employees` | Notify Employees after deploy | NO | booletan -> i.e.: `true` / `false` |
|
66
|
+
| `notify_message` | Notification message | NO | string -> i.e.: "Enjoy the new version!" |
|
67
|
+
| `changelog` | Release notes | NO | string -> i.e.: "Bug fixing" |
|
68
|
+
| `tags` | Tags to identify the build | NO | string -> comma separated. i.e.: `"RC1, QA"` |
|
69
|
+
| `filter` | List of groups that will be notified | NO | string -> comma separated + special chars. i.e.: `"group1,group2\|group3"` = (grupo1 AND grupo2) OR (grupo3) |
|
70
|
+
| `build_path` | Build path to the APK / IPA file | NO | string -> by default it takes the IPA/APK build path |
|
71
|
+
|
72
|
+
## Shared Value
|
73
|
+
Once your build is uploaded successfuly, the new generated build ID is provided by a Shared Value `APPLIVERY_BUILD_ID` that can be accesed in your lane with `lane_context[SharedValues::APPLIVERY_BUILD_ID]`
|
74
|
+
|
75
|
+
Example:
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
lane :applivery_ios do
|
79
|
+
gym(
|
80
|
+
scheme: "YOUR_APP_SCHEME", # Your App Scheme
|
81
|
+
export_method: 'enterprise') # Choose between: enterprise or ad-hoc
|
82
|
+
applivery(
|
83
|
+
app_token: "YOUR_APP_TOKEN" # Your Applivery App Token)
|
84
|
+
puts "BUILD ID: #{lane_context[SharedValues::APPLIVERY_BUILD_ID]}"
|
85
|
+
end
|
86
|
+
```
|
87
|
+
|
88
|
+
You could use this id to open your build information in applivery like:
|
89
|
+
|
90
|
+
```
|
91
|
+
https://dashboard.applivery.io/apps/apps/{YOUR_APP_SLUG}/builds?id={THIS_BUILD_ID}
|
92
|
+
```
|
70
93
|
|
71
94
|
## Run tests for this plugin
|
72
95
|
|
@@ -1,75 +1,110 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
|
1
3
|
module Fastlane
|
2
4
|
module Actions
|
5
|
+
|
6
|
+
module SharedValues
|
7
|
+
APPLIVERY_BUILD_ID = :APPLIVERY_BUILD_ID
|
8
|
+
end
|
9
|
+
|
3
10
|
class AppliveryAction < Action
|
4
11
|
|
5
12
|
def self.run(params)
|
6
|
-
app_id = params[:app_id]
|
7
|
-
api_key = params[:api_key]
|
8
|
-
name = params[:name]
|
9
|
-
notes = Helper::AppliveryHelper.escape(params[:notes])
|
10
|
-
tags = params[:tags]
|
11
13
|
build_path = params[:build_path]
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
14
|
+
build = Faraday::UploadIO.new(build_path, 'application/octet-stream') if build_path && File.exist?(build_path)
|
15
|
+
|
16
|
+
conn = Faraday.new(url: 'https://api.applivery.io') do |faraday|
|
17
|
+
faraday.request :multipart
|
18
|
+
faraday.request :url_encoded
|
19
|
+
# faraday.response :logger
|
20
|
+
faraday.use FaradayMiddleware::ParseJson
|
21
|
+
faraday.adapter :net_http
|
22
|
+
end
|
23
|
+
|
24
|
+
response = conn.post do |req|
|
25
|
+
req.url '/v1/integrations/builds'
|
26
|
+
req.headers['Content-Type'] = 'multipart/form-data'
|
27
|
+
req.headers['Accept'] = 'application/json'
|
28
|
+
req.headers['Authorization'] = "bearer #{params[:app_token]}"
|
29
|
+
request_body = {
|
30
|
+
changelog: params[:changelog],
|
31
|
+
notifyCollaborators: params[:notify_collaborators],
|
32
|
+
notifyEmployees: params[:notify_employees],
|
33
|
+
notifyMessage: params[:notify_message],
|
34
|
+
filter: params[:filter],
|
35
|
+
build: build,
|
36
|
+
deployer: {
|
37
|
+
name: "fastlane",
|
38
|
+
info: {
|
39
|
+
buildNumber: Helper::AppliveryHelper.get_integration_number,
|
40
|
+
branch: Helper::AppliveryHelper.git_branch,
|
41
|
+
commit: Helper::AppliveryHelper.git_commit,
|
42
|
+
commitMessage: Helper::AppliveryHelper.git_message,
|
43
|
+
repositoryUrl: Helper::AppliveryHelper.add_git_remote,
|
44
|
+
tag: Helper::AppliveryHelper.git_tag,
|
45
|
+
triggerTimestamp: Time.now.getutc.to_i
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
request_body[:versionName] = params[:name] if !params[:name].nil?
|
50
|
+
request_body[:tags] = params[:tags] if !params[:tags].nil?
|
51
|
+
|
52
|
+
req.body = request_body
|
53
|
+
UI.message "Uploading to Applivery... 🛫"
|
54
|
+
UI.verbose("Request Body: #{req.body}")
|
55
|
+
end
|
56
|
+
UI.verbose "Response Body: #{response.body}"
|
57
|
+
status = response.body["status"]
|
58
|
+
if status
|
59
|
+
UI.success "Build uploaded succesfully! 💪"
|
60
|
+
Actions.lane_context[SharedValues::APPLIVERY_BUILD_ID] = response.body["data"]["id"]
|
61
|
+
else
|
62
|
+
UI.error "Oops! Something went wrong.... 🔥"
|
63
|
+
error = response.body["error"]
|
64
|
+
Helper::AppliveryHelper.parse_error(error)
|
65
|
+
end
|
66
|
+
|
31
67
|
end
|
32
68
|
|
33
69
|
def self.build_path
|
34
70
|
platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]
|
71
|
+
ipa_path = Actions.lane_context[SharedValues::IPA_OUTPUT_PATH]
|
72
|
+
aab_path = Actions.lane_context[Actions::SharedValues::GRADLE_AAB_OUTPUT_PATH]
|
73
|
+
apk_path = Actions.lane_context[Actions::SharedValues::GRADLE_APK_OUTPUT_PATH]
|
35
74
|
|
36
75
|
if platform == :ios
|
37
|
-
return
|
76
|
+
return ipa_path
|
77
|
+
elsif :android and !aab_path.nil?
|
78
|
+
return aab_path
|
38
79
|
else
|
39
|
-
return
|
80
|
+
return apk_path
|
40
81
|
end
|
41
82
|
end
|
42
83
|
|
43
84
|
def self.description
|
44
|
-
"Upload new build to Applivery"
|
85
|
+
"Upload new iOS or Android build to Applivery"
|
45
86
|
end
|
46
87
|
|
47
88
|
def self.authors
|
48
|
-
["Alejandro Jimenez"]
|
89
|
+
["Alejandro Jimenez", "Cesar Trigo"]
|
49
90
|
end
|
50
91
|
|
51
92
|
def self.available_options
|
52
93
|
[
|
53
|
-
FastlaneCore::ConfigItem.new(key: :
|
54
|
-
env_name: "
|
94
|
+
FastlaneCore::ConfigItem.new(key: :app_token,
|
95
|
+
env_name: "APPLIVERY_APP_TOKEN",
|
55
96
|
description: "Your application identifier",
|
56
97
|
optional: false,
|
57
98
|
type: String),
|
58
99
|
|
59
|
-
FastlaneCore::ConfigItem.new(key: :api_key,
|
60
|
-
env_name: "APPLIVERY_API_KEY",
|
61
|
-
description: "Your developer key",
|
62
|
-
optional: false,
|
63
|
-
type: String),
|
64
|
-
|
65
100
|
FastlaneCore::ConfigItem.new(key: :name,
|
66
101
|
env_name: "APPLIVERY_BUILD_NAME",
|
67
102
|
description: "Your build name",
|
68
103
|
optional: true,
|
69
104
|
type: String),
|
70
105
|
|
71
|
-
FastlaneCore::ConfigItem.new(key: :
|
72
|
-
env_name: "
|
106
|
+
FastlaneCore::ConfigItem.new(key: :changelog,
|
107
|
+
env_name: "APPLIVERY_BUILD_CHANGELOG",
|
73
108
|
description: "Your build notes",
|
74
109
|
default_value: "Uploaded automatically with fastlane plugin",
|
75
110
|
optional: true,
|
@@ -88,19 +123,38 @@ module Fastlane
|
|
88
123
|
optional: true,
|
89
124
|
type: String),
|
90
125
|
|
91
|
-
FastlaneCore::ConfigItem.new(key: :
|
92
|
-
env_name: "
|
93
|
-
description: "Send an email to your
|
126
|
+
FastlaneCore::ConfigItem.new(key: :notify_collaborators,
|
127
|
+
env_name: "APPLIVERY_NOTIFY_COLLABORATORS",
|
128
|
+
description: "Send an email to your App Collaborators",
|
94
129
|
default_value: true,
|
95
130
|
optional: true,
|
96
131
|
is_string: false),
|
97
132
|
|
98
|
-
FastlaneCore::ConfigItem.new(key: :
|
99
|
-
env_name: "
|
100
|
-
description: "
|
133
|
+
FastlaneCore::ConfigItem.new(key: :notify_employees,
|
134
|
+
env_name: "APPLIVERY_NOTIFY_EMPLOYEES",
|
135
|
+
description: "Send an email to your App Employees",
|
101
136
|
default_value: true,
|
102
137
|
optional: true,
|
103
|
-
is_string: false)
|
138
|
+
is_string: false),
|
139
|
+
|
140
|
+
FastlaneCore::ConfigItem.new(key: :notify_message,
|
141
|
+
env_name: "APPLIVERY_NOTIFY_MESSAGE",
|
142
|
+
description: "Notification message to be sent along with email notifications",
|
143
|
+
default_value: "New version uploaded!",
|
144
|
+
optional: true,
|
145
|
+
type: String),
|
146
|
+
|
147
|
+
FastlaneCore::ConfigItem.new(key: :filter,
|
148
|
+
env_name: "APPLIVERY_FILTER",
|
149
|
+
description: "List of groups that will be notified",
|
150
|
+
optional: true,
|
151
|
+
type: String),
|
152
|
+
]
|
153
|
+
end
|
154
|
+
|
155
|
+
def self.output
|
156
|
+
[
|
157
|
+
['APPLIVERY_BUILD_ID', 'The id for the new build generated. You can open your build in https://dashboard.applivery.io/apps/apps/<YOUR_APP_SLUG>/builds?id=${APPLIVERY_BUILD_ID}']
|
104
158
|
]
|
105
159
|
end
|
106
160
|
|
@@ -118,9 +172,7 @@ module Fastlane
|
|
118
172
|
|
119
173
|
def self.example_code
|
120
174
|
[
|
121
|
-
'applivery(
|
122
|
-
app_id: "YOUR_APP_ID",
|
123
|
-
api_key: "YOUR_APP_SECRET")'
|
175
|
+
'applivery(app_token: "YOUR_APP_TOKEN")'
|
124
176
|
]
|
125
177
|
end
|
126
178
|
|
@@ -8,10 +8,6 @@ module Fastlane
|
|
8
8
|
UI.message("Hello from the applivery plugin helper!")
|
9
9
|
end
|
10
10
|
|
11
|
-
def self.escape(string)
|
12
|
-
return URI.encode(string.sub(/@/, '\@'))
|
13
|
-
end
|
14
|
-
|
15
11
|
def self.platform
|
16
12
|
platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]
|
17
13
|
if platform == :ios or platform.nil?
|
@@ -21,69 +17,77 @@ module Fastlane
|
|
21
17
|
end
|
22
18
|
end
|
23
19
|
|
24
|
-
def self.
|
20
|
+
def self.get_integration_number
|
25
21
|
xcodeIntegrationNumber = ENV["XCS_INTEGRATION_NUMBER"] # XCode Server
|
26
22
|
jenkinsIntegrationNumber = ENV["BUILD_NUMBER"] # Jenkins
|
27
23
|
travisIntegrationNumber = ENV["TRAVIS_BUILD_NUMBER"] # Travis
|
28
|
-
|
24
|
+
integrationNumber = ""
|
29
25
|
|
30
26
|
if !xcodeIntegrationNumber.nil?
|
31
|
-
|
27
|
+
integrationNumber += xcodeIntegrationNumber
|
32
28
|
elsif !jenkinsIntegrationNumber.nil?
|
33
|
-
|
29
|
+
integrationNumber += jenkinsIntegrationNumber
|
34
30
|
elsif !travisIntegrationNumber.nil?
|
35
|
-
|
31
|
+
integrationNumber += travisIntegrationNumber
|
36
32
|
end
|
37
33
|
|
38
|
-
return
|
34
|
+
return integrationNumber
|
39
35
|
end
|
40
36
|
|
41
37
|
|
42
38
|
### GIT Methods ###
|
43
39
|
|
44
|
-
def self.
|
45
|
-
Actions.
|
46
|
-
return true
|
40
|
+
def self.git_branch
|
41
|
+
return Actions.git_branch
|
47
42
|
rescue
|
48
|
-
return
|
43
|
+
return ""
|
49
44
|
end
|
50
45
|
|
51
|
-
def self.
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
gitBranch = Actions.git_branch
|
56
|
-
gitCommit = Actions.sh('git rev-parse --short HEAD')
|
57
|
-
gitMessage = Actions.last_git_commit_message
|
58
|
-
|
59
|
-
command += " -F gitBranch=\"#{gitBranch}\""
|
60
|
-
command += " -F gitCommit=\"#{gitCommit}\""
|
61
|
-
command += " -F gitMessage=\"#{self.escape(gitMessage)}\""
|
62
|
-
command += self.add_git_remote
|
63
|
-
command += self.add_git_tag
|
64
|
-
end
|
65
|
-
return command
|
46
|
+
def self.git_commit
|
47
|
+
return `git rev-parse --short HEAD`
|
48
|
+
rescue
|
49
|
+
return ""
|
66
50
|
end
|
67
51
|
|
68
|
-
def self.
|
69
|
-
|
70
|
-
gitTagCommit = Actions.sh("git rev-list -n 1 --abbrev-commit #{gitTag}")
|
71
|
-
gitCommit = Actions.sh('git rev-parse --short HEAD')
|
72
|
-
if gitTagCommit == gitCommit
|
73
|
-
return " -F gitTag=\"#{gitTag}\""
|
74
|
-
end
|
75
|
-
return ""
|
52
|
+
def self.git_message
|
53
|
+
return Actions.last_git_commit_message
|
76
54
|
rescue
|
77
55
|
return ""
|
78
56
|
end
|
79
57
|
|
80
58
|
def self.add_git_remote
|
81
|
-
|
82
|
-
return " -F gitRepositoryURL=\"#{gitRepositoryURL}\""
|
59
|
+
return `git config --get remote.origin.url`
|
83
60
|
rescue
|
84
61
|
return ""
|
85
62
|
end
|
86
63
|
|
64
|
+
def self.git_tag
|
65
|
+
gitTag = `git describe --abbrev=0 --tags`
|
66
|
+
gitTagCommit = `git rev-list -n 1 --abbrev-commit #{gitTag}`
|
67
|
+
gitCommit = `git rev-parse --short HEAD`
|
68
|
+
return gitTag if gitTagCommit == gitCommit
|
69
|
+
return ""
|
70
|
+
rescue
|
71
|
+
return ""
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.parse_error(error)
|
75
|
+
if error
|
76
|
+
case error["code"]
|
77
|
+
when 5006
|
78
|
+
UI.user_error! "Upload fail. The build path seems to be wrong or file is invalid"
|
79
|
+
when 4004
|
80
|
+
UI.user_error! "The app_token is not valid. Please, go to your app settings and doble-check the integration tokens"
|
81
|
+
when 4002
|
82
|
+
UI.user_error! "The app_token is empty. Please, go to your app Settings->Integrations to generate a token"
|
83
|
+
else
|
84
|
+
UI.user_error! "Upload fail. [#{error["code"]}]: #{error["message"]}"
|
85
|
+
end
|
86
|
+
else
|
87
|
+
UI.crash! "Upload fails unexpectedly. [#{response.status}]"
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
87
91
|
end
|
88
92
|
end
|
89
93
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-applivery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alejandro Jimenez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -106,7 +106,7 @@ files:
|
|
106
106
|
- lib/fastlane/plugin/applivery/actions/applivery_action.rb
|
107
107
|
- lib/fastlane/plugin/applivery/helper/applivery_helper.rb
|
108
108
|
- lib/fastlane/plugin/applivery/version.rb
|
109
|
-
homepage: https://github.com/
|
109
|
+
homepage: https://github.com/fastlane-community/fastlane-plugin-applivery
|
110
110
|
licenses:
|
111
111
|
- MIT
|
112
112
|
metadata: {}
|
@@ -125,8 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
|
-
|
129
|
-
rubygems_version: 2.6.12
|
128
|
+
rubygems_version: 3.0.3
|
130
129
|
signing_key:
|
131
130
|
specification_version: 4
|
132
131
|
summary: Upload new build to Applivery
|