Skip to content

Commit 2e4dba8

Browse files
committed
Add Buildkite Metadata
1 parent 99dd0a6 commit 2e4dba8

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

fastlane/lanes/build.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,15 @@
146146
lane :build_and_upload_wordpress_installable_build do
147147
UI.user_error!("'BUILDKITE_ARTIFACTS_S3_BUCKET' must be defined as an environment variable.") unless ENV['BUILDKITE_ARTIFACTS_S3_BUCKET']
148148

149+
versionName = generate_installable_build_number
149150
gradle(
150151
task: 'assemble',
151152
flavor: "WordPress#{INSTALLABLE_BUILD_FLAVOR}",
152153
build_type: INSTALLABLE_BUILD_TYPE,
153-
properties: { installableBuildVersionName: generate_installable_build_number }
154+
properties: { installableBuildVersionName: versionName }
154155
)
155156

156-
upload_installable_build(product: 'WordPress')
157+
upload_installable_build(product: 'WordPress', versionName: versionName)
157158
end
158159

159160
#####################################################################################
@@ -168,14 +169,15 @@
168169
lane :build_and_upload_jetpack_installable_build do
169170
UI.user_error!("'BUILDKITE_ARTIFACTS_S3_BUCKET' must be defined as an environment variable.") unless ENV['BUILDKITE_ARTIFACTS_S3_BUCKET']
170171

172+
versionName = generate_installable_build_number
171173
gradle(
172174
task: 'assemble',
173175
flavor: "Jetpack#{INSTALLABLE_BUILD_FLAVOR}",
174176
build_type: INSTALLABLE_BUILD_TYPE,
175-
properties: { installableBuildVersionName: generate_installable_build_number }
177+
properties: { installableBuildVersionName: versionName }
176178
)
177179

178-
upload_installable_build(product: 'Jetpack')
180+
upload_installable_build(product: 'Jetpack', versionName: versionName)
179181
end
180182

181183
#####################################################################################
@@ -246,7 +248,7 @@
246248
#
247249
# @param [String] product the display name of the app to upload to S3. 'WordPress' or 'Jetpack'
248250
#
249-
def upload_installable_build(product:)
251+
def upload_installable_build(product:, versionName:)
250252
filename = "#{product.downcase}-installable-build-#{generate_installable_build_number}.apk"
251253

252254
upload_path = upload_to_s3(
@@ -278,6 +280,7 @@ def upload_installable_build(product:)
278280
if ENV['BUILDKITE']
279281
message = "#{product} Installable Build: [#{filename}](#{install_url})"
280282
buildkite_annotate(style: 'info', context: "installable-build-#{product}", message: message)
283+
buildkite_metadata(set: { versionName: versionName, 'build:flavor': INSTALLABLE_BUILD_FLAVOR, 'build:type': INSTALLABLE_BUILD_TYPE })
281284
end
282285
end
283286

0 commit comments

Comments
 (0)