fastlane-plugin-applivery 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9789cd976f727caacd42f7cb660a5d8cb2b74f5b
|
|
4
|
+
data.tar.gz: ec67e1d5065ab11f00bbd79efbe013b1a4de508f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 24247b746914b30fbd908983639f11f06fa6c0e6ba0aba820be2082bb9a247d63c18fb2838f3ab9d9f4e264c71d284594fe965af5c9662d840698e07f2b96885
|
|
7
|
+
data.tar.gz: 7cb863833920e40e49eab5eed4f9527bd9e8b5d21533c033f2e778b11cd6f6a9313dae6b67d9cff8c06136344d7e2e5d31f5ecdc51a2cf106f446418afacb3f2
|
data/README.md
CHANGED
|
@@ -37,8 +37,7 @@ lane :applivery_ios do
|
|
|
37
37
|
scheme: "YOUR_APP_SCHEME", # Your App Scheme
|
|
38
38
|
export_method: 'enterprise') # Choose between: enterprise or ad-hoc
|
|
39
39
|
applivery(
|
|
40
|
-
app_token: "YOUR_APP_TOKEN"
|
|
41
|
-
)
|
|
40
|
+
app_token: "YOUR_APP_TOKEN") # Your Applivery App Token
|
|
42
41
|
end
|
|
43
42
|
```
|
|
44
43
|
|
|
@@ -49,8 +48,7 @@ Next you'll find a `lane` with two steps: `gradle()` that will build the Android
|
|
|
49
48
|
lane :applivery_android do
|
|
50
49
|
gradle(task: "assembleRelease")
|
|
51
50
|
applivery(
|
|
52
|
-
appToken: "YOUR_APP_TOKEN"
|
|
53
|
-
)
|
|
51
|
+
appToken: "YOUR_APP_TOKEN") # Your Applivery App Token
|
|
54
52
|
end
|
|
55
53
|
```
|
|
56
54
|
|
|
@@ -70,6 +68,28 @@ The above examples are the most simple configuration you can have but you can ad
|
|
|
70
68
|
| `tags` | Tags to identify the build | NO | string -> comma separated. i.e.: "RC1, QA" |
|
|
71
69
|
| `build_path` | Build path to the APK / IPA file | NO | string -> by default it takes the IPA/APK build path |
|
|
72
70
|
|
|
71
|
+
## Shared Value
|
|
72
|
+
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]`
|
|
73
|
+
|
|
74
|
+
Example:
|
|
75
|
+
|
|
76
|
+
```ruby
|
|
77
|
+
lane :applivery_ios do
|
|
78
|
+
gym(
|
|
79
|
+
scheme: "YOUR_APP_SCHEME", # Your App Scheme
|
|
80
|
+
export_method: 'enterprise') # Choose between: enterprise or ad-hoc
|
|
81
|
+
applivery(
|
|
82
|
+
app_token: "YOUR_APP_TOKEN" # Your Applivery App Token)
|
|
83
|
+
puts "BUILD ID: #{lane_context[SharedValues::APPLIVERY_BUILD_ID]}"
|
|
84
|
+
end
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
You could use this id to open your build information in applivery like:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
https://dashboard.applivery.io/apps/apps/{YOUR_APP_SLUG}/builds?id={THIS_BUILD_ID}
|
|
91
|
+
```
|
|
92
|
+
|
|
73
93
|
## Run tests for this plugin
|
|
74
94
|
|
|
75
95
|
To run both the tests, and code style validation, run
|
|
@@ -1,31 +1,67 @@
|
|
|
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_token = params[:app_token]
|
|
7
|
-
name = params[:name]
|
|
8
|
-
changelog = Helper::AppliveryHelper.escape(params[:changelog])
|
|
9
|
-
notify_message = Helper::AppliveryHelper.escape(params[:notify_message])
|
|
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
|
-
|
|
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
|
+
build: build,
|
|
35
|
+
deployer: {
|
|
36
|
+
name: "fastlane",
|
|
37
|
+
info: {
|
|
38
|
+
buildNumber: Helper::AppliveryHelper.get_integration_number,
|
|
39
|
+
branch: Helper::AppliveryHelper.git_branch,
|
|
40
|
+
commit: Helper::AppliveryHelper.git_commit,
|
|
41
|
+
commitMessage: Helper::AppliveryHelper.git_message,
|
|
42
|
+
repositoryUrl: Helper::AppliveryHelper.add_git_remote,
|
|
43
|
+
tag: Helper::AppliveryHelper.git_tag,
|
|
44
|
+
triggerTimestamp: Time.now.getutc.to_i
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
request_body[:versionName] = params[:name] if !params[:name].nil?
|
|
49
|
+
request_body[:tags] = params[:tags] if !params[:tags].nil?
|
|
50
|
+
|
|
51
|
+
req.body = request_body
|
|
52
|
+
UI.message "Uploading to Applivery... 🛫"
|
|
53
|
+
UI.verbose("Request Body: #{req.body}")
|
|
54
|
+
end
|
|
55
|
+
UI.verbose "Response Body: #{response.body}"
|
|
56
|
+
status = response.body["status"]
|
|
57
|
+
Actions.lane_context[SharedValues::APPLIVERY_BUILD_ID] = response.body["data"]["id"]
|
|
58
|
+
if status
|
|
59
|
+
UI.success "Build uploaded succesfully! 💪"
|
|
60
|
+
else
|
|
61
|
+
UI.error "Oops! Something went wrong.... 🔥"
|
|
62
|
+
Helper::AppliveryHelper.parse_error(response.error)
|
|
63
|
+
end
|
|
64
|
+
|
|
29
65
|
end
|
|
30
66
|
|
|
31
67
|
def self.build_path
|
|
@@ -104,6 +140,12 @@ module Fastlane
|
|
|
104
140
|
]
|
|
105
141
|
end
|
|
106
142
|
|
|
143
|
+
def self.output
|
|
144
|
+
[
|
|
145
|
+
['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}']
|
|
146
|
+
]
|
|
147
|
+
end
|
|
148
|
+
|
|
107
149
|
def self.is_supported?(platform)
|
|
108
150
|
# Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
|
|
109
151
|
# See: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
|
|
@@ -118,8 +160,7 @@ module Fastlane
|
|
|
118
160
|
|
|
119
161
|
def self.example_code
|
|
120
162
|
[
|
|
121
|
-
'applivery(
|
|
122
|
-
app_token: "YOUR_APP_TOKEN")'
|
|
163
|
+
'applivery(app_token: "YOUR_APP_TOKEN")'
|
|
123
164
|
]
|
|
124
165
|
end
|
|
125
166
|
|
|
@@ -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 deployer.info.branch=\"#{gitBranch}\""
|
|
60
|
-
command += " -F deployer.info.commit=\"#{gitCommit}\""
|
|
61
|
-
command += " -F deployer.info.commitMessage=\"#{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 deployer.info.tag=\"#{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 deployer.info.repositoryUrl=\"#{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: 2.
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alejandro Jimenez
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-09-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: pry
|