fastlane-plugin-appcircle_enterprise_app_store 0.0.1 → 0.0.2

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
  SHA256:
3
- metadata.gz: 6d8856c9fc564231df28f4de8dfa86c654b63e39953c16985425944abf4a41f6
4
- data.tar.gz: 9ac3b5154d041cc5c973de767f8fb22812e85078e37bcb1d8f649aad7bee4d38
3
+ metadata.gz: cff33ed704573f46fb622cd361572fa22147077a004fc0536de3b94468ec8fa4
4
+ data.tar.gz: e33541f26974d0a4672fbadf064a26677a8f5fd4400b37cb231d39cf08559f2f
5
5
  SHA512:
6
- metadata.gz: cb5cf60eb158cb46a539f6cf55032b8b8f952dfe1011ffa95773b53fa5bdbda668515adf00a0edbfea1b64f9200089218b8d20b4498a3af67f5160fcf6c62ed2
7
- data.tar.gz: a1c96695801bb0eb112926c3201799881731d4fa51c4aaff5d908d767d1532ecc4355f143859674766faabe3d3660bf749c74abced9e0726d12cb82532feec15
6
+ metadata.gz: 9d033f2fc9b88f3da5cbee8721735d691de2280fadde54e8e6ef9fb9534fbcd875b0a4914a2fa3f9533619c583cd41eb7681790d6d780f48badc68ee1a0d6b48
7
+ data.tar.gz: c0e23d17dcc61170598a3263c2886f51202d06c0f44a6d68abe6189a9297cd7bdd10b5c04619d8a63d67c70ec5d59492880cb8bbae19a9126ecc4853ddca9d42
@@ -16,6 +16,7 @@ module Fastlane
16
16
 
17
17
  def self.run(params)
18
18
  personalAPIToken = params[:personalAPIToken]
19
+ personalAccessKey = params[:personalAccessKey]
19
20
  appPath = params[:appPath]
20
21
  summary = params[:summary]
21
22
  releaseNotes = params[:releaseNotes]
@@ -28,8 +29,10 @@ module Fastlane
28
29
  raise "Invalid file extension: #{file_extension}. For Android, use .apk. For iOS, use .ipa."
29
30
  end
30
31
 
31
- if personalAPIToken.nil?
32
- raise UI.error("Please provide Personal API Token to authenticate connections to Appcircle services")
32
+ if personalAPIToken.nil? && personalAccessKey.nil?
33
+ raise UI.error("Please provide either Personal API Token (personalAPIToken) or Personal Access Key (personalAccessKey) to authenticate connections to Appcircle services")
34
+ elsif !personalAPIToken.nil? && !personalAccessKey.nil?
35
+ raise UI.error("Please provide only one authentication method: either Personal API Token (personalAPIToken) or Personal Access Key (personalAccessKey), not both")
33
36
  elsif appPath.nil?
34
37
  raise UI.error("Please 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")
35
38
  elsif summary.nil?
@@ -43,12 +46,16 @@ module Fastlane
43
46
  end
44
47
 
45
48
 
46
- self.ac_login(personalAPIToken)
49
+ if !personalAPIToken.nil?
50
+ self.ac_login_with_pat(personalAPIToken)
51
+ else
52
+ self.ac_login_with_pak(personalAccessKey)
53
+ end
47
54
  self.uploadToProfile(appPath, summary, releaseNotes, publishType)
48
55
  end
49
56
 
50
57
 
51
- def self.ac_login(accessToken)
58
+ def self.ac_login_with_pat(accessToken)
52
59
  begin
53
60
  user = AuthService.get_ac_token(pat: accessToken)
54
61
  UI.success("Login is successful.")
@@ -59,6 +66,17 @@ module Fastlane
59
66
  end
60
67
  end
61
68
 
69
+ def self.ac_login_with_pak(personalAccessKey)
70
+ begin
71
+ user = AuthService.get_ac_token_with_pak(personal_access_key: personalAccessKey)
72
+ UI.success("Login is successful.")
73
+ @@apiToken = user.accessToken
74
+ rescue => e
75
+ UI.error("Login failed: #{e.message}")
76
+ raise e
77
+ end
78
+ end
79
+
62
80
 
63
81
  def self.checkTaskStatus(taskId)
64
82
  uri = URI.parse("https://api.appcircle.io/task/v1/tasks/#{taskId}")
@@ -150,8 +168,14 @@ module Fastlane
150
168
  [
151
169
  FastlaneCore::ConfigItem.new(key: :personalAPIToken,
152
170
  env_name: "AC_PERSONAL_API_TOKEN",
153
- description: "Provide Personal API Token to authenticate Appcircle services",
154
- optional: false,
171
+ description: "Provide Personal API Token to authenticate Appcircle services (use either personalAPIToken or personalAccessKey)",
172
+ optional: true,
173
+ type: String),
174
+
175
+ FastlaneCore::ConfigItem.new(key: :personalAccessKey,
176
+ env_name: "AC_PERSONAL_ACCESS_KEY",
177
+ description: "Provide Personal Access Key to authenticate Appcircle services (use either personalAPIToken or personalAccessKey)",
178
+ optional: true,
155
179
  type: String),
156
180
 
157
181
  FastlaneCore::ConfigItem.new(key: :appPath,
@@ -33,6 +33,38 @@ module AuthService
33
33
 
34
34
 
35
35
 
36
+ # Check response
37
+ if response.is_a?(Net::HTTPSuccess)
38
+ response_data = JSON.parse(response.body)
39
+
40
+ user = UserResponse.new(
41
+ accessToken: response_data['access_token']
42
+ )
43
+
44
+ return user
45
+ else
46
+ raise "HTTP Request failed (#{response.code} #{response.message})"
47
+ end
48
+ end
49
+
50
+ def self.get_ac_token_with_pak(personal_access_key:)
51
+ endpoint_url = 'https://auth.appcircle.io/auth/v1/token'
52
+ uri = URI(endpoint_url)
53
+
54
+ # Create HTTP request
55
+ request = Net::HTTP::Post.new(uri)
56
+ request.content_type = 'application/x-www-form-urlencoded'
57
+ request['Accept'] = 'application/json'
58
+
59
+ # Encode parameters
60
+ params = { 'personal-access-key' => personal_access_key }
61
+ request.body = URI.encode_www_form(params)
62
+
63
+ # Make the HTTP request
64
+ response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
65
+ http.request(request)
66
+ end
67
+
36
68
  # Check response
37
69
  if response.is_a?(Net::HTTPSuccess)
38
70
  response_data = JSON.parse(response.body)
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module AppcircleEnterpriseAppStore
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-appcircle_enterprise_app_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - appcircleio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-04 00:00:00.000000000 Z
11
+ date: 2025-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client