Skip to content

Commit 88ae20c

Browse files
committed
Promote to production via track promotion instead of a new release
`promote_version_code_to_production` now uses `upload_to_play_store` with `track_promote_to` (the Play Console "Promote" action) instead of building a new production release via `update_track`. This extends the already-reviewed beta release to the production track — same versionCode, no new binary — so the beta release's notes and name carry over automatically. Ships as a live staged rollout (`inProgress` at 0.1%); `advance_production_rollout` grows it from there.
1 parent 55a1f70 commit 88ae20c

1 file changed

Lines changed: 22 additions & 34 deletions

File tree

fastlane/lanes/promote.rb

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -417,42 +417,30 @@ def distribute_to_production(version_code:)
417417
end
418418
end
419419

420-
# Creates a `production` release referencing an already-uploaded version code, via the Play API —
421-
# the same approach as promote_version_code_to_beta (see there for why upload_to_play_store can't).
420+
# Promotes the existing beta build to production — the scripted equivalent of the Play Console
421+
# "Promote" button. `track_promote_to` extends the already-reviewed beta release to the production
422+
# track (same versionCode, no new binary): supply reuses that beta TrackRelease, so its release
423+
# notes and name carry over automatically, and its version codes (incl. the retained legacy code)
424+
# come along too.
422425
def promote_version_code_to_production(package_name:, version_code:)
423-
require 'supply'
424-
require 'supply/options'
425-
426-
Supply.config = FastlaneCore::Configuration.create(
427-
Supply::Options.available_options,
428-
{ json_key: UPLOAD_TO_PLAY_STORE_JSON_KEY, package_name: package_name, track: PRODUCTION_TRACK }
426+
upload_to_play_store(
427+
package_name: package_name,
428+
json_key: UPLOAD_TO_PLAY_STORE_JSON_KEY,
429+
track: BETA_TRACK,
430+
track_promote_to: PRODUCTION_TRACK,
431+
version_code: Integer(version_code),
432+
# Promote as a live staged rollout: a `rollout` in (0, 1) makes supply set the promoted
433+
# release to `inProgress` at that user fraction. Starting tiny (0.1%) exercises the full
434+
# production flow end to end; `advance_production_rollout` grows it from there.
435+
rollout: '0.001',
436+
# Promotion touches only the track release, never a binary — skip every upload path.
437+
skip_upload_apk: true,
438+
skip_upload_aab: true,
439+
skip_upload_metadata: true,
440+
skip_upload_changelogs: true,
441+
skip_upload_images: true,
442+
skip_upload_screenshots: true
429443
)
430-
431-
with_play_edit_retries("Promoting #{version_code} to production for #{package_name}") do
432-
client = Supply::Client.make_from_config
433-
client.begin_edit(package_name: package_name)
434-
435-
committed = false
436-
begin
437-
release = AndroidPublisher::TrackRelease.new(
438-
# TODO: swap `draft` for the staged rollout below once the full production flow is ready;
439-
# until then it ships as a draft a human starts from the Play Console.
440-
status: 'draft',
441-
# status: 'inProgress',
442-
# user_fraction: 0.001,
443-
version_codes: [Integer(version_code), *PLAY_STORE_VERSION_CODES_TO_RETAIN]
444-
)
445-
track = client.tracks(PRODUCTION_TRACK).first || AndroidPublisher::Track.new(track: PRODUCTION_TRACK)
446-
track.releases = [release]
447-
448-
client.update_track(PRODUCTION_TRACK, track)
449-
client.commit_current_edit!
450-
committed = true
451-
ensure
452-
# Discard the edit if we bailed before committing (a committed edit can't be aborted).
453-
client.abort_current_edit unless committed
454-
end
455-
end
456444
end
457445

458446
#################################################

0 commit comments

Comments
 (0)