fastlane-plugin-app_dropper 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: 76c011d561432b70d2ec3994e11145fd34e8ade523503b8d2548f4b266fa43cd
4
- data.tar.gz: c19756277bd79750da48a86bf2693ce372ff923be66447f185b29993e57f2eb1
3
+ metadata.gz: 1d3020186f9c2e3297f5ae241d12cba7c29645a8c3f98553e4aefc341ecf40ce
4
+ data.tar.gz: 5cdb45f416a0147f9a153f163d43746127728aad1a4537b9054c7cb98ea78863
5
5
  SHA512:
6
- metadata.gz: c6f423e2b20583c66fc536c928960879929dc247bf80c63344faad52eb6b988a54f554144bb825460bda1af229b358a562f65df3d9ae2a43c4823b9f523c3139
7
- data.tar.gz: ab27205510035b373d668fc31b4df2ccdb91e77729d65f21e2c920322d9450c9d98bff3e1e4da22d299105a450fc91c21a090bff14a22e1de7c202c162206992
6
+ metadata.gz: f8b1ca9d27327d2a139abb98c7a6fdb21314b9a5c93ed5dce38c9912ffffbdbbfa99b37581919b88a280fc47ce63cea80823e070c12424232a7ab279ff07365f
7
+ data.tar.gz: 6689adae8e1fd98fc531779fb6e780f7f0570e2ac8f28d85d6eabdb0ed54e1a46d4b9eb2e7ae4b41095af1eb900810549d88e4ea09fd8bc7e7179fbaa3e6dbae
data/README.md CHANGED
@@ -16,7 +16,7 @@ Generate an API token under **Settings → API tokens** in your App Dropper dash
16
16
  export APPDROPPER_TOKEN="adp_…"
17
17
  ```
18
18
 
19
- Each token is scoped to a single app and carries one scope, `upload:builds` — it cannot delete builds, manage testers, read billing, or reach another app.
19
+ A token covers either all your apps (the default, including new ones: the first upload of a new bundle ID creates its app) or only the apps you pick. Either way it carries one scope, `upload:builds` — it cannot delete builds, manage testers or read billing.
20
20
 
21
21
  ## Usage
22
22
 
@@ -108,6 +108,16 @@ app_dropper(
108
108
 
109
109
  Both block the lane until the build is processed and both return a link. App Dropper additionally groups builds into an app with full version history, notifies your registered testers by email and push, and keeps builds for 7 days on free or 30 on Pro (indefinitely if you pin one).
110
110
 
111
+ ## What your testers are told
112
+
113
+ A successful upload emails and push-notifies everyone on the app with *"A new
114
+ version is available for {your app}"* — the account the token belongs to
115
+ included, since nobody watched the lane run. Running inside CI, the plugin
116
+ reads the runner's environment (GitHub Actions, GitLab CI, Bitrise, CircleCI,
117
+ Bitbucket Pipelines, Codemagic, Jenkins and friends) so that email can name the
118
+ branch and commit and link back to the build. Set `APPDROPPER_NO_CI_INFO=1` to
119
+ leave those details out.
120
+
111
121
  ## How it works
112
122
 
113
123
  The binary never passes through the API. The action reserves an upload (which is where every plan limit and quota is applied), streams the file straight to Google Cloud Storage, then waits for the server to parse it. That's what keeps a 500 MB `.ipa` clear of the request-size ceilings every HTTP API has.
@@ -42,7 +42,8 @@ module Fastlane
42
42
  result = helper.await_upload(ticket['upload_id'], timeout: params[:timeout])
43
43
 
44
44
  if result['status'] == 'error'
45
- UI.user_error!("App Dropper: #{result.dig('error', 'message') || 'the build could not be processed.'}")
45
+ message = Helper::AppDropperHelper.plan_limit_message(result['error'])
46
+ UI.user_error!("App Dropper: #{message.empty? ? 'the build could not be processed.' : message}")
46
47
  end
47
48
  unless result['status'] == 'ready'
48
49
  UI.user_error!("App Dropper: the build is still processing after #{params[:timeout]}s. Nothing was lost — check your dashboard.")
@@ -19,18 +19,141 @@ module Fastlane
19
19
  # enough that a wedged lane eventually fails instead of hanging a CI job.
20
20
  DEFAULT_TIMEOUT = 600
21
21
 
22
+ # A plan-limit error with the upgrade path on its own line, so it stands
23
+ # out in a lane's log: "Upgrade to Pro: https://appdropper.io/pricing".
24
+ # Reads the API's `upgrade` block; without one (an older server) the
25
+ # message already says where to upgrade, and is returned unchanged.
26
+ def self.plan_limit_message(error)
27
+ error = {} unless error.is_a?(Hash)
28
+ message = error['message'].to_s
29
+ upgrade = error['upgrade']
30
+ return message unless upgrade.is_a?(Hash) && !upgrade['upgrade_url'].to_s.empty?
31
+
32
+ reason = message.sub(/\s*(Upgrade to (Pro|Studio)\b|Contact support@).*\z/m, '').strip
33
+ if upgrade['upgrade_to'].to_s.empty?
34
+ "#{reason} Contact #{upgrade['upgrade_url'].sub(/\Amailto:/, '')} to raise this limit."
35
+ else
36
+ "#{reason}\nUpgrade to #{upgrade['upgrade_to'].capitalize}: #{upgrade['upgrade_url']}"
37
+ end
38
+ end
39
+
22
40
  def initialize(api_token:, api_url: nil)
23
41
  @api_token = api_token
24
42
  @api_url = (api_url || ENV['APPDROPPER_API_URL'] || DEFAULT_API_URL).chomp('/')
25
43
  end
26
44
 
27
45
  def create_upload(file_name:, file_size:, release_notes:, tag:)
28
- post('/uploads', {
46
+ body = {
29
47
  file_name: file_name,
30
48
  file_size: file_size,
31
49
  release_notes: release_notes.to_s,
32
50
  tag: tag.to_s
33
- })
51
+ }
52
+ ci = self.class.ci_info
53
+ body[:ci] = ci unless ci.empty?
54
+ post('/uploads', body)
55
+ end
56
+
57
+ # Which pipeline this lane is running in, read off the runner's
58
+ # environment. App Dropper quotes it back in the "a new version is
59
+ # available" email its testers and managers get, so they can see the
60
+ # branch and commit the build in their hands came from. Empty on a
61
+ # developer's machine, and suppressed entirely by APPDROPPER_NO_CI_INFO.
62
+ def self.ci_info
63
+ return {} if present(ENV['APPDROPPER_NO_CI_INFO'])
64
+
65
+ info =
66
+ if present(ENV['GITHUB_ACTIONS'])
67
+ repo = ENV['GITHUB_REPOSITORY']
68
+ run = ENV['GITHUB_RUN_ID']
69
+ server = present(ENV['GITHUB_SERVER_URL']) || 'https://github.com'
70
+ {
71
+ provider: 'GitHub Actions',
72
+ repo: repo,
73
+ branch: branch_name(ENV['GITHUB_HEAD_REF'] || ENV['GITHUB_REF_NAME'] || ENV['GITHUB_REF']),
74
+ commit: ENV['GITHUB_SHA'],
75
+ actor: ENV['GITHUB_ACTOR'],
76
+ run_url: repo && run ? "#{server}/#{repo}/actions/runs/#{run}" : nil
77
+ }
78
+ elsif present(ENV['GITLAB_CI'])
79
+ {
80
+ provider: 'GitLab CI',
81
+ repo: ENV['CI_PROJECT_PATH'],
82
+ branch: ENV['CI_COMMIT_BRANCH'] || ENV['CI_COMMIT_REF_NAME'],
83
+ commit: ENV['CI_COMMIT_SHA'],
84
+ actor: ENV['GITLAB_USER_LOGIN'],
85
+ run_url: ENV['CI_JOB_URL'] || ENV['CI_PIPELINE_URL']
86
+ }
87
+ elsif present(ENV['BITRISE_IO'])
88
+ {
89
+ provider: 'Bitrise',
90
+ repo: repo_slug(ENV['GIT_REPOSITORY_URL']) || ENV['BITRISE_APP_TITLE'],
91
+ branch: ENV['BITRISE_GIT_BRANCH'],
92
+ commit: ENV['BITRISE_GIT_COMMIT'],
93
+ run_url: ENV['BITRISE_BUILD_URL']
94
+ }
95
+ elsif present(ENV['CIRCLECI'])
96
+ owner = ENV['CIRCLE_PROJECT_USERNAME']
97
+ name = ENV['CIRCLE_PROJECT_REPONAME']
98
+ {
99
+ provider: 'CircleCI',
100
+ repo: owner && name ? "#{owner}/#{name}" : name,
101
+ branch: ENV['CIRCLE_BRANCH'],
102
+ commit: ENV['CIRCLE_SHA1'],
103
+ actor: ENV['CIRCLE_USERNAME'],
104
+ run_url: ENV['CIRCLE_BUILD_URL']
105
+ }
106
+ elsif present(ENV['BITBUCKET_BUILD_NUMBER'])
107
+ repo = ENV['BITBUCKET_REPO_FULL_NAME']
108
+ build = ENV['BITBUCKET_BUILD_NUMBER']
109
+ {
110
+ provider: 'Bitbucket Pipelines',
111
+ repo: repo,
112
+ branch: ENV['BITBUCKET_BRANCH'],
113
+ commit: ENV['BITBUCKET_COMMIT'],
114
+ run_url: repo && build ? "https://bitbucket.org/#{repo}/pipelines/results/#{build}" : nil
115
+ }
116
+ elsif present(ENV['CM_BUILD_ID'])
117
+ {
118
+ provider: 'Codemagic',
119
+ repo: ENV['CM_REPO_SLUG'] || ENV['FCI_REPO_SLUG'],
120
+ branch: ENV['CM_BRANCH'] || ENV['FCI_BRANCH'],
121
+ commit: ENV['CM_COMMIT'] || ENV['FCI_COMMIT'],
122
+ run_url: ENV['CM_BUILD_URL'] || ENV['FCI_BUILD_URL']
123
+ }
124
+ elsif present(ENV['JENKINS_URL'])
125
+ {
126
+ provider: 'Jenkins',
127
+ repo: repo_slug(ENV['GIT_URL']) || ENV['JOB_NAME'],
128
+ branch: branch_name(ENV['BRANCH_NAME'] || ENV['GIT_BRANCH']),
129
+ commit: ENV['GIT_COMMIT'],
130
+ run_url: ENV['BUILD_URL']
131
+ }
132
+ elsif present(ENV['CI'])
133
+ { provider: 'CI' }
134
+ else
135
+ {}
136
+ end
137
+
138
+ info.reject { |_k, v| present(v).nil? }
139
+ end
140
+
141
+ def self.present(value)
142
+ return nil if value.nil?
143
+
144
+ stripped = value.to_s.strip
145
+ stripped.empty? ? nil : stripped
146
+ end
147
+
148
+ # "refs/heads/main" -> "main", and Jenkins' "origin/main" -> "main".
149
+ def self.branch_name(ref)
150
+ present(ref)&.sub(%r{\Arefs/(heads|tags)/}, '')&.sub(%r{\Aorigin/}, '')
151
+ end
152
+
153
+ # "git@github.com:acme/app.git" -> "acme/app"
154
+ def self.repo_slug(url)
155
+ match = present(url)&.match(%r{[:/]([^/:]+/[^/]+?)(?:\.git)?/?\z})
156
+ match && match[1]
34
157
  end
35
158
 
36
159
  # A single PUT of the whole file. Net::HTTP streams from the IO rather
@@ -115,15 +238,20 @@ module Fastlane
115
238
  return parsed if response.is_a?(Net::HTTPSuccess)
116
239
 
117
240
  message = parsed.dig('error', 'message') || "HTTP #{response.code}"
241
+ error = parsed['error'].is_a?(Hash) ? parsed['error'] : {}
242
+ error_with_message = error.merge('message' => message)
118
243
  # The API answers 401/403 for a token problem; naming it here saves the
119
244
  # usual round of "is the secret even set?" debugging.
120
245
  case response.code.to_i
121
246
  when 401, 403
122
247
  UI.user_error!("App Dropper: #{message} Check that APPDROPPER_TOKEN is set and scoped to this app.")
123
248
  when 402
124
- UI.user_error!("App Dropper: #{message}")
249
+ # A plan limit: retrying won't help, so say where to upgrade.
250
+ UI.user_error!("App Dropper: #{self.class.plan_limit_message(error_with_message)}")
125
251
  when 429
126
- UI.user_error!("App Dropper: #{message}")
252
+ # Rate limits clear on their own; the hourly upload cap also says
253
+ # where to upgrade.
254
+ UI.user_error!("App Dropper: #{self.class.plan_limit_message(error_with_message)}")
127
255
  else
128
256
  UI.user_error!("App Dropper: #{message}")
129
257
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module AppDropper
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-app_dropper
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
  - App Dropper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-15 00:00:00.000000000 Z
11
+ date: 2026-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler