fastlane-plugin-appforshare 1.0.0 → 1.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
  SHA256:
3
- metadata.gz: aee20a5b8c8408a2f2c378c1505861079a8d105a8b02349ef6b2eb5224825ed0
4
- data.tar.gz: fc0dd2c5963ea01feadd098cc60f503e912d7204deeda3fb0d8ec6b1c5f1f53e
3
+ metadata.gz: beddf76a00ee95aee77c292f523d005bb6a37a7e246936222a50496a5392db3c
4
+ data.tar.gz: 565985cd9fa6ad4fe0966d35b61be965c89e7a2f9b1d87090fda1b60230cb517
5
5
  SHA512:
6
- metadata.gz: a5134d0a31ed40d12f0be48c44e9aa1ec79d77328a7d02dce515e64bb8b3317f5878a8f1ce367273075ec03bde8795080778b14c7c1f7dec3cb1b8f60cccef69
7
- data.tar.gz: 00356bda06a9a8418525a13243de865d83ab7c32a1a92a53a67c6fe2d0bf68fd4a6699c0bc8965a78d6344336f53a5ed0a3af081168d24aeede6e13c9a52087a
6
+ metadata.gz: b1a06c336d21e0b9252bb047862b091fe9e34ae2f1be61c1cdf29c28c2f50f78bb6aec2daf94c546e7dc96cc45e7ff8b438e0a59a3aff335129ec58958e2ddf5
7
+ data.tar.gz: 571203cceac457fc55497a87351f3a7ee820babdc9b58b3283c11f0ed02ef9bb6ead1ac9043cd28607d1e7ac3eebbf332bd438cb51a1349e6fc187ea3d22ab6c
data/README.md CHANGED
@@ -23,9 +23,11 @@ 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) |
26
27
  | `fail_on` | `APPFORSHARE_FAIL_ON` | `blocked` or `review`: fail the lane on the store readiness check. The build stays uploaded. |
27
28
 
28
- Lane context after the action: `APPFORSHARE_URL`, `APPFORSHARE_SLUG`, `APPFORSHARE_READINESS`. The store readiness
29
+ Lane context after the action: `APPFORSHARE_URL`, `APPFORSHARE_SLUG`, `APPFORSHARE_READINESS`, and with `channel:`
30
+ `APPFORSHARE_CHANNEL_URL`. The store readiness
29
31
  check is guidance about current App Store and Google Play rules, not a promise of approval.
30
32
 
31
33
  MIT license. Source: https://github.com/appforshare/fastlane-plugin-appforshare
@@ -7,6 +7,7 @@ module Fastlane
7
7
  APPFORSHARE_URL = :APPFORSHARE_URL
8
8
  APPFORSHARE_SLUG = :APPFORSHARE_SLUG
9
9
  APPFORSHARE_READINESS = :APPFORSHARE_READINESS
10
+ APPFORSHARE_CHANNEL_URL = :APPFORSHARE_CHANNEL_URL
10
11
  end
11
12
 
12
13
  class AppforshareAction < Action
@@ -14,7 +15,7 @@ module Fastlane
14
15
  file = params[:file]
15
16
  UI.user_error!('No build to upload. Pass file: or run gym / gradle first.') unless file && File.exist?(file)
16
17
  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])
18
+ status = client.upload(file, notes: params[:release_notes], channel: params[:channel])
18
19
  readiness = 'unknown'
19
20
  findings = []
20
21
  begin
@@ -29,7 +30,10 @@ module Fastlane
29
30
  Actions.lane_context[SharedValues::APPFORSHARE_URL] = status['url']
30
31
  Actions.lane_context[SharedValues::APPFORSHARE_SLUG] = status['slug']
31
32
  Actions.lane_context[SharedValues::APPFORSHARE_READINESS] = readiness
33
+ Actions.lane_context[SharedValues::APPFORSHARE_CHANNEL_URL] = status.dig('channel', 'url')
32
34
  UI.success("Install link: #{status['url']}")
35
+ UI.success("Channel #{status['channel']['name']}: #{status['channel']['url']}") if status['channel']
36
+ UI.important("Not put into channel #{params[:channel]}. Check the build page.") if params[:channel] && !status['channel']
33
37
  UI.message("Store readiness: #{readiness}")
34
38
  findings.each { |f| UI.important("[#{f['level']}] #{f['title']}: #{f['fix']}") }
35
39
  fail_on = params[:fail_on]
@@ -62,7 +66,8 @@ module Fastlane
62
66
  [
63
67
  ['APPFORSHARE_URL', 'Install link'],
64
68
  ['APPFORSHARE_SLUG', 'Share code of the build'],
65
- ['APPFORSHARE_READINESS', 'Store readiness status: ready, review, blocked or unknown']
69
+ ['APPFORSHARE_READINESS', 'Store readiness status: ready, review, blocked or unknown'],
70
+ ['APPFORSHARE_CHANNEL_URL', 'Stable link of the channel (with channel:), always the newest build in it']
66
71
  ]
67
72
  end
68
73
 
@@ -73,6 +78,7 @@ module Fastlane
73
78
  default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH] || Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH],
74
79
  default_value_dynamic: true),
75
80
  FastlaneCore::ConfigItem.new(key: :release_notes, env_name: 'APPFORSHARE_RELEASE_NOTES', description: 'Release notes shown to testers (Pro and Team)', optional: true),
81
+ 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),
76
82
  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
83
  verify_block: proc { |v| UI.user_error!('fail_on takes "blocked" or "review"') unless %w[blocked review].include?(v) }),
78
84
  FastlaneCore::ConfigItem.new(key: :api_url, env_name: 'APPFORSHARE_API', description: 'API origin', optional: true, default_value: 'https://appforshare.io')
@@ -82,6 +88,7 @@ module Fastlane
82
88
  def self.example_code
83
89
  [
84
90
  'appforshare(release_notes: "Fixes the login crash")',
91
+ 'appforshare(channel: "beta")',
85
92
  'appforshare(file: "app/build/outputs/apk/release/app-release.apk", fail_on: "blocked")'
86
93
  ]
87
94
  end
@@ -14,10 +14,11 @@ 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)
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?
21
22
  created = request(:post, '/uploads', json: body)
22
23
  @log.call("Uploading #{File.basename(path)} (#{format('%.1f', size / 1024.0 / 1024)} MB)")
23
24
  offset = created['offset'] || 0
@@ -35,7 +36,16 @@ module Fastlane
35
36
  loop do
36
37
  s = request(:get, "/uploads/#{created['id']}", headers: headers)
37
38
  raise Error, (s['error'] || 'The build could not be processed.') if s['status'] == 'FAILED'
38
- return s if s['status'] == 'READY'
39
+ if s['status'] == 'READY'
40
+ # The channel is filled in right after the build is ready.
41
+ 5.times do
42
+ break if body[:channel].nil? || s['channel']
43
+
44
+ sleep 1
45
+ s = request(:get, "/uploads/#{created['id']}", headers: headers)
46
+ end
47
+ return s
48
+ end
39
49
  raise Error, 'Processing is taking too long. Check your dashboard.' if Time.now > deadline
40
50
 
41
51
  sleep 2
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Appforshare
3
- VERSION = '1.0.0'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
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.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - AppForShare