fastlane-plugin-appforshare 1.0.0 → 1.2.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
  SHA256:
3
- metadata.gz: aee20a5b8c8408a2f2c378c1505861079a8d105a8b02349ef6b2eb5224825ed0
4
- data.tar.gz: fc0dd2c5963ea01feadd098cc60f503e912d7204deeda3fb0d8ec6b1c5f1f53e
3
+ metadata.gz: 6761c93eb02620c8efd05cdcedb4b4d55476275af8a792865b6da39ce2f8c6a6
4
+ data.tar.gz: 6422775c4165461bb5fc75efa2043f53b708412fdd5ee6fe943b6daa8a207140
5
5
  SHA512:
6
- metadata.gz: a5134d0a31ed40d12f0be48c44e9aa1ec79d77328a7d02dce515e64bb8b3317f5878a8f1ce367273075ec03bde8795080778b14c7c1f7dec3cb1b8f60cccef69
7
- data.tar.gz: 00356bda06a9a8418525a13243de865d83ab7c32a1a92a53a67c6fe2d0bf68fd4a6699c0bc8965a78d6344336f53a5ed0a3af081168d24aeede6e13c9a52087a
6
+ metadata.gz: ebd32a3b17654348db87bc5ec5ff9f0d80d6e2c1c4d001fbe685aa878be2d266efd809145617a03a066d999f2a06b93d1ff38e5ea5d1535b47de6220fb200cda
7
+ data.tar.gz: 134108be2e5522917c9f2cd6d3b43380563f4ea187c2391435284a4e320fe463e072fad89a2b1157e4c764257dcadc0bf4f645da1338249de341f0e9bdbcc0bc
data/README.md CHANGED
@@ -23,9 +23,41 @@ the build from gym (`IPA_OUTPUT_PATH`) or gradle (`GRADLE_APK_OUTPUT_PATH`).
23
23
  | `api_token` | `APPFORSHARE_TOKEN` | API token |
24
24
  | `file` | `APPFORSHARE_FILE` | .ipa or .apk |
25
25
  | `release_notes` | `APPFORSHARE_RELEASE_NOTES` | Shown to testers (Pro and Team) |
26
+ | `channel` | `APPFORSHARE_CHANNEL` | Put the build into a channel (`beta`, `live`), created on first use. Its link always opens the newest build in it (Pro and Team) |
27
+ | `groups` | `APPFORSHARE_GROUPS` | Share the build with these tester groups when it is ready (Team) |
28
+ | `testers` | `APPFORSHARE_TESTERS` | Share the build with these tester emails when it is ready (Team) |
26
29
  | `fail_on` | `APPFORSHARE_FAIL_ON` | `blocked` or `review`: fail the lane on the store readiness check. The build stays uploaded. |
27
30
 
28
- Lane context after the action: `APPFORSHARE_URL`, `APPFORSHARE_SLUG`, `APPFORSHARE_READINESS`. The store readiness
31
+ Lane context after the action: `APPFORSHARE_URL`, `APPFORSHARE_SLUG`, `APPFORSHARE_READINESS`, and with `channel:`
32
+ `APPFORSHARE_CHANNEL_URL`. The store readiness
29
33
  check is guidance about current App Store and Google Play rules, not a promise of approval.
30
34
 
35
+ ## Testers, groups and devices
36
+
37
+ The same jobs as Firebase App Distribution's fastlane actions, with no Google account for your testers.
38
+
39
+ | Action | What it does |
40
+ |---|---|
41
+ | `appforshare_add_testers(emails:, file:, project:, groups:, notify:)` | Add testers, optionally to a project and groups (Team) |
42
+ | `appforshare_remove_testers(emails:, file:, project:)` | Remove testers, or with `project:` only the access you gave them there (Team) |
43
+ | `appforshare_create_group(name:, project:, emails:)` | Make a tester group, optionally on a project and with members (Team) |
44
+ | `appforshare_delete_group(name:)` | Delete a group; its members stay testers (Team) |
45
+ | `appforshare_udids(output_file:)` | Write the UDIDs testers sent to a file in Apple's format (`APPFORSHARE_UDIDS_FILE`) |
46
+ | `appforshare_latest(app:, platform:, channel:)` | Newest build: `APPFORSHARE_LATEST_VERSION`, `APPFORSHARE_LATEST_BUILD_NUMBER`, `APPFORSHARE_LATEST_URL` |
47
+
48
+ ```ruby
49
+ lane :devices do
50
+ appforshare_udids(output_file: "devices.txt")
51
+ register_devices(devices_file: "devices.txt")
52
+ match(type: "adhoc", force_for_new_devices: true)
53
+ end
54
+
55
+ lane :beta_android do
56
+ latest = appforshare_latest(app: "com.example.shop", platform: "android")
57
+ increment_version_code(version_code: latest["versionCode"].to_i + 1)
58
+ gradle(task: "assembleRelease")
59
+ appforshare(groups: "Client QA", testers: "pm@client.com")
60
+ end
61
+ ```
62
+
31
63
  MIT license. Source: https://github.com/appforshare/fastlane-plugin-appforshare
@@ -1,5 +1,6 @@
1
1
  require 'fastlane/action'
2
2
  require_relative '../helper/client'
3
+ require_relative 'appforshare_base'
3
4
 
4
5
  module Fastlane
5
6
  module Actions
@@ -7,6 +8,7 @@ module Fastlane
7
8
  APPFORSHARE_URL = :APPFORSHARE_URL
8
9
  APPFORSHARE_SLUG = :APPFORSHARE_SLUG
9
10
  APPFORSHARE_READINESS = :APPFORSHARE_READINESS
11
+ APPFORSHARE_CHANNEL_URL = :APPFORSHARE_CHANNEL_URL
10
12
  end
11
13
 
12
14
  class AppforshareAction < Action
@@ -14,7 +16,8 @@ module Fastlane
14
16
  file = params[:file]
15
17
  UI.user_error!('No build to upload. Pass file: or run gym / gradle first.') unless file && File.exist?(file)
16
18
  client = Helper::AppforshareClient.new(token: params[:api_token], api: params[:api_url], log: ->(m) { UI.message(m) })
17
- status = client.upload(file, notes: params[:release_notes])
19
+ status = client.upload(file, notes: params[:release_notes], channel: params[:channel],
20
+ groups: Helper::AppforshareShared.list(params[:groups]), testers: Helper::AppforshareShared.list(params[:testers]))
18
21
  readiness = 'unknown'
19
22
  findings = []
20
23
  begin
@@ -29,7 +32,10 @@ module Fastlane
29
32
  Actions.lane_context[SharedValues::APPFORSHARE_URL] = status['url']
30
33
  Actions.lane_context[SharedValues::APPFORSHARE_SLUG] = status['slug']
31
34
  Actions.lane_context[SharedValues::APPFORSHARE_READINESS] = readiness
35
+ Actions.lane_context[SharedValues::APPFORSHARE_CHANNEL_URL] = status.dig('channel', 'url')
32
36
  UI.success("Install link: #{status['url']}")
37
+ UI.success("Channel #{status['channel']['name']}: #{status['channel']['url']}") if status['channel']
38
+ UI.important("Not put into channel #{params[:channel]}. Check the build page.") if params[:channel] && !status['channel']
33
39
  UI.message("Store readiness: #{readiness}")
34
40
  findings.each { |f| UI.important("[#{f['level']}] #{f['title']}: #{f['fix']}") }
35
41
  fail_on = params[:fail_on]
@@ -62,7 +68,8 @@ module Fastlane
62
68
  [
63
69
  ['APPFORSHARE_URL', 'Install link'],
64
70
  ['APPFORSHARE_SLUG', 'Share code of the build'],
65
- ['APPFORSHARE_READINESS', 'Store readiness status: ready, review, blocked or unknown']
71
+ ['APPFORSHARE_READINESS', 'Store readiness status: ready, review, blocked or unknown'],
72
+ ['APPFORSHARE_CHANNEL_URL', 'Stable link of the channel (with channel:), always the newest build in it']
66
73
  ]
67
74
  end
68
75
 
@@ -73,6 +80,9 @@ module Fastlane
73
80
  default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH] || Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH],
74
81
  default_value_dynamic: true),
75
82
  FastlaneCore::ConfigItem.new(key: :release_notes, env_name: 'APPFORSHARE_RELEASE_NOTES', description: 'Release notes shown to testers (Pro and Team)', optional: true),
83
+ FastlaneCore::ConfigItem.new(key: :channel, env_name: 'APPFORSHARE_CHANNEL', description: 'Put the build into this channel (Beta, Live), created on first use (Pro and Team)', optional: true),
84
+ FastlaneCore::ConfigItem.new(key: :groups, env_name: 'APPFORSHARE_GROUPS', description: 'Share the build with these tester groups when ready (Team)', optional: true, type: Array),
85
+ FastlaneCore::ConfigItem.new(key: :testers, env_name: 'APPFORSHARE_TESTERS', description: 'Share the build with these tester emails when ready (Team)', optional: true, type: Array),
76
86
  FastlaneCore::ConfigItem.new(key: :fail_on, env_name: 'APPFORSHARE_FAIL_ON', description: 'Fail the lane when store readiness is "blocked", or "review"', optional: true,
77
87
  verify_block: proc { |v| UI.user_error!('fail_on takes "blocked" or "review"') unless %w[blocked review].include?(v) }),
78
88
  FastlaneCore::ConfigItem.new(key: :api_url, env_name: 'APPFORSHARE_API', description: 'API origin', optional: true, default_value: 'https://appforshare.io')
@@ -82,6 +92,8 @@ module Fastlane
82
92
  def self.example_code
83
93
  [
84
94
  'appforshare(release_notes: "Fixes the login crash")',
95
+ 'appforshare(channel: "beta")',
96
+ 'appforshare(groups: "Client QA", testers: "pm@client.com")',
85
97
  'appforshare(file: "app/build/outputs/apk/release/app-release.apk", fail_on: "blocked")'
86
98
  ]
87
99
  end
@@ -0,0 +1,50 @@
1
+ require_relative 'appforshare_base'
2
+
3
+ module Fastlane
4
+ module Actions
5
+ class AppforshareAddTestersAction < Action
6
+ def self.run(params)
7
+ s = Helper::AppforshareShared
8
+ emails = s.list(params[:emails], params[:file])
9
+ UI.user_error!('No tester emails. Pass emails: or file:') if emails.empty?
10
+ r = s.client(params).add_testers(emails, project: params[:project], groups: s.list(params[:groups]), notify: params[:notify])
11
+ UI.success("#{r['added']} new tester(s) added, #{r['updated']} already there#{params[:notify] ? '' : ', no invites sent'}.")
12
+ r
13
+ rescue Helper::AppforshareClient::Error => e
14
+ UI.user_error!(e.message)
15
+ end
16
+
17
+ def self.description
18
+ 'Add testers to AppForShare, optionally to a project and tester groups (Team)'
19
+ end
20
+
21
+ def self.authors
22
+ ['AppForShare']
23
+ end
24
+
25
+ def self.return_value
26
+ 'Hash with added and updated counts'
27
+ end
28
+
29
+ def self.available_options
30
+ s = Helper::AppforshareShared
31
+ [s.token_option, *s.emails_options, s.project_option,
32
+ FastlaneCore::ConfigItem.new(key: :groups, env_name: 'APPFORSHARE_GROUPS', description: 'Tester group names, comma separated or an array', optional: true, type: Array),
33
+ FastlaneCore::ConfigItem.new(key: :notify, env_name: 'APPFORSHARE_NOTIFY', description: 'Email new testers an invite', optional: true, type: Boolean, default_value: true),
34
+ s.api_option]
35
+ end
36
+
37
+ def self.example_code
38
+ ['appforshare_add_testers(emails: "sara@example.com, omar@example.com", groups: "Client QA")', 'appforshare_add_testers(file: "testers.txt", project: 12, notify: false)']
39
+ end
40
+
41
+ def self.category
42
+ :beta
43
+ end
44
+
45
+ def self.is_supported?(platform)
46
+ %i[ios android].include?(platform)
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,39 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/client'
3
+
4
+ module Fastlane
5
+ module Helper
6
+ # Options and client shared by the tester, group, UDID and latest build actions.
7
+ module AppforshareShared
8
+ def self.client(params)
9
+ Helper::AppforshareClient.new(token: params[:api_token], api: params[:api_url], log: ->(m) { UI.message(m) })
10
+ end
11
+
12
+ # "a@x.com, b@y.com" or an array; a file with one per line or comma separated.
13
+ def self.list(value, file = nil)
14
+ items = Array(value).flat_map { |v| v.to_s.split(/[,\n\r]+/) }
15
+ items += File.read(file).split(/[,\n\r]+/) if file && !file.empty?
16
+ items.map(&:strip).reject(&:empty?)
17
+ end
18
+
19
+ def self.token_option
20
+ FastlaneCore::ConfigItem.new(key: :api_token, env_name: 'APPFORSHARE_TOKEN', description: 'AppForShare API token (Dashboard, Settings)', sensitive: true, optional: false)
21
+ end
22
+
23
+ def self.api_option
24
+ FastlaneCore::ConfigItem.new(key: :api_url, env_name: 'APPFORSHARE_API', description: 'API origin', optional: true, default_value: 'https://appforshare.io')
25
+ end
26
+
27
+ def self.project_option
28
+ FastlaneCore::ConfigItem.new(key: :project, env_name: 'APPFORSHARE_PROJECT', description: 'Project id (appforshare builds --json shows it)', optional: true, type: Integer)
29
+ end
30
+
31
+ def self.emails_options
32
+ [
33
+ FastlaneCore::ConfigItem.new(key: :emails, env_name: 'APPFORSHARE_TESTERS', description: 'Tester emails, comma separated or an array', optional: true, type: Array),
34
+ FastlaneCore::ConfigItem.new(key: :file, env_name: 'APPFORSHARE_TESTERS_FILE', description: 'File with tester emails, one per line or comma separated', optional: true)
35
+ ]
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,55 @@
1
+ require_relative 'appforshare_base'
2
+
3
+ module Fastlane
4
+ module Actions
5
+ class AppforshareCreateGroupAction < Action
6
+ def self.run(params)
7
+ s = Helper::AppforshareShared
8
+ c = s.client(params)
9
+ r = c.create_group(params[:name], project: params[:project])
10
+ UI.success("Group #{r['name']} made.")
11
+ emails = s.list(params[:emails], params[:file])
12
+ unless emails.empty?
13
+ m = c.add_group_members(params[:name], emails, notify: params[:notify])
14
+ UI.success("#{m['group']} now has #{m['members']} member(s).")
15
+ end
16
+ r
17
+ rescue Helper::AppforshareClient::Error => e
18
+ UI.user_error!(e.message)
19
+ end
20
+
21
+ def self.description
22
+ 'Make an AppForShare tester group, optionally on a project and with members (Team)'
23
+ end
24
+
25
+ def self.authors
26
+ ['AppForShare']
27
+ end
28
+
29
+ def self.return_value
30
+ 'Hash with the group id and name'
31
+ end
32
+
33
+ def self.available_options
34
+ s = Helper::AppforshareShared
35
+ [s.token_option,
36
+ FastlaneCore::ConfigItem.new(key: :name, env_name: 'APPFORSHARE_GROUP', description: 'Group name', optional: false),
37
+ s.project_option, *s.emails_options,
38
+ FastlaneCore::ConfigItem.new(key: :notify, env_name: 'APPFORSHARE_NOTIFY', description: 'Invite members who can install something new', optional: true, type: Boolean, default_value: true),
39
+ s.api_option]
40
+ end
41
+
42
+ def self.example_code
43
+ ['appforshare_create_group(name: "Client QA", project: 12, emails: "qa@client.com")']
44
+ end
45
+
46
+ def self.category
47
+ :beta
48
+ end
49
+
50
+ def self.is_supported?(platform)
51
+ %i[ios android].include?(platform)
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,40 @@
1
+ require_relative 'appforshare_base'
2
+
3
+ module Fastlane
4
+ module Actions
5
+ class AppforshareDeleteGroupAction < Action
6
+ def self.run(params)
7
+ r = Helper::AppforshareShared.client(params).delete_group(params[:name])
8
+ UI.success("Group #{r['deleted']} deleted. Its members stay testers.")
9
+ r
10
+ rescue Helper::AppforshareClient::Error => e
11
+ UI.user_error!(e.message)
12
+ end
13
+
14
+ def self.description
15
+ 'Delete an AppForShare tester group; members keep access given to them directly (Team)'
16
+ end
17
+
18
+ def self.authors
19
+ ['AppForShare']
20
+ end
21
+
22
+ def self.available_options
23
+ s = Helper::AppforshareShared
24
+ [s.token_option, FastlaneCore::ConfigItem.new(key: :name, env_name: 'APPFORSHARE_GROUP', description: 'Group name', optional: false), s.api_option]
25
+ end
26
+
27
+ def self.example_code
28
+ ['appforshare_delete_group(name: "Old beta")']
29
+ end
30
+
31
+ def self.category
32
+ :beta
33
+ end
34
+
35
+ def self.is_supported?(platform)
36
+ %i[ios android].include?(platform)
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,63 @@
1
+ require_relative 'appforshare_base'
2
+
3
+ module Fastlane
4
+ module Actions
5
+ module SharedValues
6
+ APPFORSHARE_LATEST_VERSION = :APPFORSHARE_LATEST_VERSION
7
+ APPFORSHARE_LATEST_BUILD_NUMBER = :APPFORSHARE_LATEST_BUILD_NUMBER
8
+ APPFORSHARE_LATEST_URL = :APPFORSHARE_LATEST_URL
9
+ end
10
+
11
+ class AppforshareLatestAction < Action
12
+ def self.run(params)
13
+ b = Helper::AppforshareShared.client(params).latest(platform: params[:platform], app: params[:app], channel: params[:channel])
14
+ Actions.lane_context[SharedValues::APPFORSHARE_LATEST_VERSION] = b['version']
15
+ Actions.lane_context[SharedValues::APPFORSHARE_LATEST_BUILD_NUMBER] = b['versionCode']
16
+ Actions.lane_context[SharedValues::APPFORSHARE_LATEST_URL] = b['url']
17
+ UI.success("Newest build: #{b['name']} #{b['version']} (#{b['versionCode']}) #{b['url']}")
18
+ b
19
+ rescue Helper::AppforshareClient::Error => e
20
+ UI.user_error!(e.message)
21
+ end
22
+
23
+ def self.description
24
+ 'Read the newest AppForShare build (version, build number, install link), for example to bump the build number'
25
+ end
26
+
27
+ def self.authors
28
+ ['AppForShare']
29
+ end
30
+
31
+ def self.return_value
32
+ 'Hash with the build: version, versionCode, url, slug and more'
33
+ end
34
+
35
+ def self.output
36
+ [['APPFORSHARE_LATEST_VERSION', 'Version of the newest build'], ['APPFORSHARE_LATEST_BUILD_NUMBER', 'Its build number'], ['APPFORSHARE_LATEST_URL', 'Its install link']]
37
+ end
38
+
39
+ def self.available_options
40
+ s = Helper::AppforshareShared
41
+ [s.token_option,
42
+ FastlaneCore::ConfigItem.new(key: :platform, env_name: 'APPFORSHARE_PLATFORM', description: 'ios or android', optional: true,
43
+ verify_block: proc { |v| UI.user_error!('platform takes "ios" or "android"') unless %w[ios android].include?(v) }),
44
+ FastlaneCore::ConfigItem.new(key: :app, env_name: 'APPFORSHARE_APP', description: 'Bundle id or package name', optional: true),
45
+ FastlaneCore::ConfigItem.new(key: :channel, env_name: 'APPFORSHARE_CHANNEL', description: 'Only builds in this channel', optional: true),
46
+ s.api_option]
47
+ end
48
+
49
+ def self.example_code
50
+ ['latest = appforshare_latest(app: "com.example.shop", platform: "android")
51
+ increment_version_code(version_code: latest["versionCode"].to_i + 1)']
52
+ end
53
+
54
+ def self.category
55
+ :beta
56
+ end
57
+
58
+ def self.is_supported?(platform)
59
+ %i[ios android].include?(platform)
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,48 @@
1
+ require_relative 'appforshare_base'
2
+
3
+ module Fastlane
4
+ module Actions
5
+ class AppforshareRemoveTestersAction < Action
6
+ def self.run(params)
7
+ s = Helper::AppforshareShared
8
+ emails = s.list(params[:emails], params[:file])
9
+ UI.user_error!('No tester emails. Pass emails: or file:') if emails.empty?
10
+ r = s.client(params).remove_testers(emails, project: params[:project])
11
+ UI.success("#{r['removed']} tester(s) removed#{params[:project] ? ' from the project' : ''}.")
12
+ UI.important("Not testers: #{r['notFound'].join(', ')}") unless (r['notFound'] || []).empty?
13
+ r
14
+ rescue Helper::AppforshareClient::Error => e
15
+ UI.user_error!(e.message)
16
+ end
17
+
18
+ def self.description
19
+ 'Remove testers from AppForShare, or with project: only the access you gave them to that project (Team)'
20
+ end
21
+
22
+ def self.authors
23
+ ['AppForShare']
24
+ end
25
+
26
+ def self.return_value
27
+ 'Hash with removed and notFound'
28
+ end
29
+
30
+ def self.available_options
31
+ s = Helper::AppforshareShared
32
+ [s.token_option, *s.emails_options, s.project_option, s.api_option]
33
+ end
34
+
35
+ def self.example_code
36
+ ['appforshare_remove_testers(emails: "omar@example.com")']
37
+ end
38
+
39
+ def self.category
40
+ :beta
41
+ end
42
+
43
+ def self.is_supported?(platform)
44
+ %i[ios android].include?(platform)
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,64 @@
1
+ require_relative 'appforshare_base'
2
+
3
+ module Fastlane
4
+ module Actions
5
+ module SharedValues
6
+ APPFORSHARE_UDIDS_FILE = :APPFORSHARE_UDIDS_FILE
7
+ end
8
+
9
+ class AppforshareUdidsAction < Action
10
+ def self.run(params)
11
+ text = Helper::AppforshareShared.client(params).udids
12
+ File.write(params[:output_file], text)
13
+ count = [text.lines.count - 1, 0].max
14
+ Actions.lane_context[SharedValues::APPFORSHARE_UDIDS_FILE] = params[:output_file]
15
+ UI.success("#{count} device(s) written to #{params[:output_file]}")
16
+ params[:output_file]
17
+ rescue Helper::AppforshareClient::Error => e
18
+ UI.user_error!(e.message)
19
+ end
20
+
21
+ def self.description
22
+ 'Write the UDIDs testers sent to AppForShare to a file in Apple\'s Register Multiple Devices format'
23
+ end
24
+
25
+ def self.details
26
+ 'Pass the file to register_devices(devices_file:) and then match(force_for_new_devices: true), like Firebase\'s get_udids. ' \
27
+ 'AppForShare can also register devices on Apple and remake the profile for you from the Devices page.'
28
+ end
29
+
30
+ def self.authors
31
+ ['AppForShare']
32
+ end
33
+
34
+ def self.return_value
35
+ 'Path of the written file'
36
+ end
37
+
38
+ def self.output
39
+ [['APPFORSHARE_UDIDS_FILE', 'Path of the devices file']]
40
+ end
41
+
42
+ def self.available_options
43
+ s = Helper::AppforshareShared
44
+ [s.token_option,
45
+ FastlaneCore::ConfigItem.new(key: :output_file, env_name: 'APPFORSHARE_UDIDS_FILE', description: 'Where to write the devices file', optional: true, default_value: 'appforshare-devices.txt'),
46
+ s.api_option]
47
+ end
48
+
49
+ def self.example_code
50
+ ['appforshare_udids(output_file: "devices.txt")
51
+ register_devices(devices_file: "devices.txt")
52
+ match(type: "adhoc", force_for_new_devices: true)']
53
+ end
54
+
55
+ def self.category
56
+ :beta
57
+ end
58
+
59
+ def self.is_supported?(platform)
60
+ platform == :ios
61
+ end
62
+ end
63
+ end
64
+ end
@@ -14,10 +14,13 @@ module Fastlane
14
14
  @log = log || ->(_msg) {}
15
15
  end
16
16
 
17
- def upload(path, notes: nil)
17
+ def upload(path, notes: nil, channel: nil, groups: [], testers: [])
18
18
  size = File.size(path)
19
19
  body = { fileName: File.basename(path), size: size }
20
20
  body[:releaseNotes] = notes[0, 5000] if notes && !notes.empty?
21
+ body[:channel] = channel if channel && !channel.empty?
22
+ body[:groups] = groups unless groups.empty?
23
+ body[:testers] = testers unless testers.empty?
21
24
  created = request(:post, '/uploads', json: body)
22
25
  @log.call("Uploading #{File.basename(path)} (#{format('%.1f', size / 1024.0 / 1024)} MB)")
23
26
  offset = created['offset'] || 0
@@ -35,7 +38,16 @@ module Fastlane
35
38
  loop do
36
39
  s = request(:get, "/uploads/#{created['id']}", headers: headers)
37
40
  raise Error, (s['error'] || 'The build could not be processed.') if s['status'] == 'FAILED'
38
- return s if s['status'] == 'READY'
41
+ if s['status'] == 'READY'
42
+ # The channel is filled in right after the build is ready.
43
+ 5.times do
44
+ break if body[:channel].nil? || s['channel']
45
+
46
+ sleep 1
47
+ s = request(:get, "/uploads/#{created['id']}", headers: headers)
48
+ end
49
+ return s
50
+ end
39
51
  raise Error, 'Processing is taking too long. Check your dashboard.' if Time.now > deadline
40
52
 
41
53
  sleep 2
@@ -46,6 +58,54 @@ module Fastlane
46
58
  request(:get, "/ci/builds/#{URI.encode_www_form_component(ref)}")
47
59
  end
48
60
 
61
+ # Newest build, optionally of one platform, app (bundle id or package) or channel.
62
+ def latest(platform: nil, app: nil, channel: nil)
63
+ q = URI.encode_www_form({ platform: platform, app: app, channel: channel }.compact)
64
+ request(:get, "/ci/builds/latest#{q.empty? ? '' : "?#{q}"}")
65
+ end
66
+
67
+ def add_testers(emails, project: nil, groups: [], notify: true)
68
+ request(:post, '/ci/testers', json: { emails: emails, groups: groups, notify: notify }.merge(project ? { project: project } : {}))
69
+ end
70
+
71
+ def remove_testers(emails, project: nil)
72
+ request(:post, '/ci/testers/remove', json: { emails: emails }.merge(project ? { project: project } : {}))
73
+ end
74
+
75
+ def create_group(name, project: nil)
76
+ request(:post, '/ci/tester-groups', json: { name: name }.merge(project ? { project: project } : {}))
77
+ end
78
+
79
+ def delete_group(name)
80
+ request(:delete, "/ci/tester-groups/#{URI.encode_www_form_component(name).gsub('+', '%20')}")
81
+ end
82
+
83
+ def add_group_members(name, emails, notify: true)
84
+ request(:post, "/ci/tester-groups/#{URI.encode_www_form_component(name).gsub('+', '%20')}/members", json: { emails: emails, notify: notify })
85
+ end
86
+
87
+ def distribute(ref, groups: [], testers: [], notify: true)
88
+ request(:post, "/ci/builds/#{URI.encode_www_form_component(ref)}/distribute", json: { groups: groups, testers: testers, notify: notify })
89
+ end
90
+
91
+ # The workspace's iPhone and iPad UDIDs in Apple's "Register Multiple Devices" format.
92
+ def udids
93
+ request_raw(:get, '/ci/devices/apple-devices.txt')
94
+ end
95
+
96
+ def request_raw(method, path)
97
+ uri = URI("#{@api}/api#{path}")
98
+ req = { get: Net::HTTP::Get }[method].new(uri)
99
+ req['Authorization'] = "Bearer #{@token}"
100
+ req['User-Agent'] = "fastlane-plugin-appforshare/#{Fastlane::Appforshare::VERSION}"
101
+ res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https', read_timeout: 60) { |http| http.request(req) }
102
+ unless (200..299).cover?(res.code.to_i)
103
+ data = (JSON.parse(res.body) rescue {})
104
+ raise Error, (data['message'] || "Request failed with #{res.code}")
105
+ end
106
+ res.body.to_s
107
+ end
108
+
49
109
  def request(method, path, json: nil, body: nil, headers: {})
50
110
  uri = URI("#{@api}/api#{path}")
51
111
  attempt = 0
@@ -67,7 +127,9 @@ module Fastlane
67
127
  code = res.code.to_i
68
128
  raise IOError, "HTTP #{code}" if code >= 500 && attempt < 6
69
129
  offset_reply = code == 400 && data['offset'].is_a?(Integer)
70
- unless (200..299).cover?(code) || code == 409 || offset_reply
130
+ # 409 means "already have these bytes" on the resumable upload only; elsewhere it is a real conflict.
131
+ resumed = code == 409 && path.start_with?('/uploads')
132
+ unless (200..299).cover?(code) || resumed || offset_reply
71
133
  msg = data['message'].is_a?(Array) ? data['message'].first : data['message']
72
134
  raise Error, (msg || "Request failed with #{code}")
73
135
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Appforshare
3
- VERSION = '1.0.0'
3
+ VERSION = '1.2.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-appforshare
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - AppForShare
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-31 00:00:00.000000000 Z
11
+ date: 2026-11-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Fastlane action that uploads an .ipa or .apk to AppForShare (appforshare.io),
14
14
  waits for it to be ready, returns the install link and the store readiness status,
@@ -22,6 +22,13 @@ files:
22
22
  - README.md
23
23
  - lib/fastlane/plugin/appforshare.rb
24
24
  - lib/fastlane/plugin/appforshare/actions/appforshare_action.rb
25
+ - lib/fastlane/plugin/appforshare/actions/appforshare_add_testers_action.rb
26
+ - lib/fastlane/plugin/appforshare/actions/appforshare_base.rb
27
+ - lib/fastlane/plugin/appforshare/actions/appforshare_create_group_action.rb
28
+ - lib/fastlane/plugin/appforshare/actions/appforshare_delete_group_action.rb
29
+ - lib/fastlane/plugin/appforshare/actions/appforshare_latest_action.rb
30
+ - lib/fastlane/plugin/appforshare/actions/appforshare_remove_testers_action.rb
31
+ - lib/fastlane/plugin/appforshare/actions/appforshare_udids_action.rb
25
32
  - lib/fastlane/plugin/appforshare/helper/client.rb
26
33
  - lib/fastlane/plugin/appforshare/version.rb
27
34
  homepage: https://appforshare.io/docs/ci