fastlane-plugin-appcircle_testing_distribution 0.1.4 → 0.1.6
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
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a02bb68865ce3d94c903651486aa0da0dd6ce65b1a031d49f9ae65dd1f280df3
|
4
|
+
data.tar.gz: 7cf9e84c39f8dac3db289e273d15b4b458baf1a3c3c8307e1fa04ae483dcda07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c220a3b09805d02df2e3cab87bb4cb89714a00a27b598cfc83a51f61436b3ee84c709c4378effbf161fed1654b2fe2250dc95fcefff34a45c60896ed2a76c0e
|
7
|
+
data.tar.gz: 387fc503a7975c0f8fa3f021e4f5c466c79a8cdcc11b9c38669c932bfe7d96469bb53b6a8181c3fcb6059f160ade2612f306f74518ec407cf966dd938f814e97
|
data/README.md
CHANGED
@@ -42,7 +42,7 @@ Overall, using testing distribution in mobile DevOps significantly enhances the
|
|
42
42
|
|
43
43
|
In order to share your builds with testers, you can create distribution profiles and assign testing groups to the distribution profiles.
|
44
44
|
|
45
|
-
![Distribution Profile](
|
45
|
+
![Distribution Profile](<https://cdn.appcircle.io/docs/assets/image%20(152).png>)
|
46
46
|
|
47
47
|
## Generating/Managing the Personal API Tokens
|
48
48
|
|
@@ -52,7 +52,7 @@ To generate a Personal API Token, follow these steps:
|
|
52
52
|
2. You'll find the Personal API Token section in the top right corner.
|
53
53
|
3. Press the "Generate Token" button to generate your first token.
|
54
54
|
|
55
|
-
![Token Generation](
|
55
|
+
![Token Generation](<https://cdn.appcircle.io/docs/assets/image%20(164).png>)
|
56
56
|
|
57
57
|
## Getting Started with the Extension: Usage Guide
|
58
58
|
|
@@ -1,4 +1,7 @@
|
|
1
1
|
require 'fastlane/action'
|
2
|
+
require 'net/http'
|
3
|
+
require 'uri'
|
4
|
+
require 'json'
|
2
5
|
require_relative '../helper/appcircle_testing_distribution_helper'
|
3
6
|
|
4
7
|
module Fastlane
|
@@ -10,9 +13,19 @@ module Fastlane
|
|
10
13
|
appPath = params[:appPath]
|
11
14
|
message = params[:message]
|
12
15
|
|
16
|
+
if accessToken.nil?
|
17
|
+
raise UI.error("Access token is required to authenticate connections to Appcircle services. Please provide a valid access token")
|
18
|
+
elsif profileID.nil?
|
19
|
+
raise UI.error("Distribution profile ID is required to distribute applications. Please provide a valid distribution profile ID")
|
20
|
+
elsif appPath.nil?
|
21
|
+
raise UI.error("Application file path is required to distribute applications. Please provide a valid application file path")
|
22
|
+
elsif message.nil?
|
23
|
+
raise UI.error("Message field is required. Please provide a valid message")
|
24
|
+
end
|
25
|
+
|
26
|
+
|
13
27
|
self.ac_login(accessToken)
|
14
28
|
self.ac_upload(appPath, profileID, message)
|
15
|
-
|
16
29
|
end
|
17
30
|
|
18
31
|
def self.ac_login(accessToken)
|
@@ -23,10 +36,48 @@ module Fastlane
|
|
23
36
|
raise "Error executing command of logging to Appcircle. Please make sure you have installed Appcircle CLI and provided a valid access token. For more information, please visit https://docs.appcircle.io/appcircle-api/api-authentication#generatingmanaging-the-personal-api-tokens #{ac_login}"
|
24
37
|
end
|
25
38
|
end
|
39
|
+
|
40
|
+
def self.checkTaskStatus(taskId)
|
41
|
+
uri = URI.parse("https://api.appcircle.io/task/v1/tasks/#{taskId}")
|
42
|
+
timeout = 1
|
43
|
+
jwtToken = `appcircle config get AC_ACCESS_TOKEN -o json`
|
44
|
+
apiAccessToken = JSON.parse(jwtToken)
|
45
|
+
|
46
|
+
response = self.send_request(uri, apiAccessToken["AC_ACCESS_TOKEN"])
|
47
|
+
if response.is_a?(Net::HTTPSuccess)
|
48
|
+
stateValue = JSON.parse(response.body)["stateValue"]
|
49
|
+
|
50
|
+
if stateValue == 1
|
51
|
+
sleep(1)
|
52
|
+
return checkTaskStatus(taskId)
|
53
|
+
end
|
54
|
+
if stateValue == 3
|
55
|
+
return true
|
56
|
+
else
|
57
|
+
UI.error("Task Id #{taskId} failed with state value #{stateValue}")
|
58
|
+
raise "Upload could not completed successfully"
|
59
|
+
end
|
60
|
+
else
|
61
|
+
UI.error("Request failed with response code #{response.code} and message #{response.message}")
|
62
|
+
raise "Request failed"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.send_request(uri, access_token)
|
67
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
68
|
+
http.use_ssl = (uri.scheme == "https")
|
69
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
70
|
+
request["Authorization"] = "Bearer #{access_token}"
|
71
|
+
http.request(request)
|
72
|
+
end
|
26
73
|
|
27
74
|
def self.ac_upload(appPath, profileID, message)
|
28
|
-
ac_upload = `appcircle testing-distribution upload --app=#{appPath} --distProfileId=#{profileID} --message "#{message}"
|
29
|
-
|
75
|
+
ac_upload = `appcircle testing-distribution upload --app=#{appPath} --distProfileId=#{profileID} --message "#{message}" -o json`
|
76
|
+
taskId = JSON.parse(ac_upload)["taskId"]
|
77
|
+
UI.message("taskID #{taskId}")
|
78
|
+
result = self.checkTaskStatus(taskId)
|
79
|
+
|
80
|
+
if $?.success? and result
|
30
81
|
UI.success("#{appPath} Uploaded to Appcircle successfully.")
|
31
82
|
else
|
32
83
|
raise "Error executing command of uploading to Appcircle. Please make sure you have provide the valid app path and distribution profile id. For more information\n" + ac_upload
|
@@ -53,28 +104,28 @@ module Fastlane
|
|
53
104
|
def self.available_options
|
54
105
|
[
|
55
106
|
FastlaneCore::ConfigItem.new(key: :accessToken,
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
107
|
+
env_name: "AC_ACCESS_TOKEN",
|
108
|
+
description: "Provide the Appcircle access token to authenticate connections to Appcircle services",
|
109
|
+
optional: false,
|
110
|
+
type: String),
|
60
111
|
|
61
112
|
FastlaneCore::ConfigItem.new(key: :profileID,
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
113
|
+
env_name: "AC_PROFILE_ID",
|
114
|
+
description: "Enter the ID of the Appcircle distribution profile. This ID uniquely identifies the profile under which your applications will be distributed",
|
115
|
+
optional: false,
|
116
|
+
type: String),
|
66
117
|
|
67
118
|
FastlaneCore::ConfigItem.new(key: :appPath,
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
119
|
+
env_name: "AC_APP_PATH",
|
120
|
+
description: "Specify the path to your application file. For iOS, this can be a .ipa or .xcarchive file path. For Android, specify the .apk or .appbundle file path",
|
121
|
+
optional: false,
|
122
|
+
type: String),
|
123
|
+
|
73
124
|
FastlaneCore::ConfigItem.new(key: :message,
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
125
|
+
env_name: "AC_MESSAGE",
|
126
|
+
description: "Optional message to include with the distribution to provide additional information to testers or users receiving the build",
|
127
|
+
optional: false,
|
128
|
+
type: String)
|
78
129
|
]
|
79
130
|
end
|
80
131
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-appcircle_testing_distribution
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- appcircleio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: cloud@appcircle.io
|