Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .buildkite/commands/build-trunk-internal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash -eu

echo "--- :rubygems: Setting up Gems"
install_gems

echo "--- :closed_lock_with_key: Installing Secrets"
bundle exec fastlane run configure_apply

echo "--- :hammer_and_wrench: Build WordPress & Jetpack and upload to the Play internal track"
bundle exec fastlane build_and_upload_trunk_internal skip_confirm:true skip_prechecks:true
16 changes: 16 additions & 0 deletions .buildkite/schedules/build-trunk-internal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
---

# Builds WordPress & Jetpack from `trunk` and uploads them to the Play Store `internal` testing
# track, to validate the "release from trunk" model. Runs on a schedule (configured in the
# Buildkite UI); also triggerable manually via the `PIPELINE` env var for testing.

agents:
queue: "android"

steps:
- label: ":android: Build trunk → Play internal"
command: .buildkite/commands/build-trunk-internal.sh
plugins: [$CI_TOOLKIT]
notify:
- slack: "#build-and-ship"
53 changes: 53 additions & 0 deletions fastlane/lanes/build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,59 @@
create_gh_release(app: app, version_name: version_name, prerelease: true) if options[:create_release]
end

#####################################################################################
# build_and_upload_trunk_internal
# -----------------------------------------------------------------------------------
# Builds WordPress & Jetpack from the current commit and uploads them to the Play Store
# `internal` testing track. Intended to run from `trunk` (manually or on a schedule) to
# validate the "release from trunk" model.
#
# The version is computed on the fly and written to `version.properties` for the build
# only — it is NOT committed:
# - versionName: the planned release version (without the `-rc-N` suffix)
# - versionCode: via release-toolkit's `ContinuousBuildCodeFormatter`,
# i.e. `(major * 10 + minor) * 1_000_000 + BUILDKITE_BUILD_NUMBER`
# -----------------------------------------------------------------------------------
# Usage:
# bundle exec fastlane build_and_upload_trunk_internal [skip_confirm:<true|false>] [skip_prechecks:<true|false>]
#####################################################################################
desc 'Build WordPress & Jetpack from trunk and upload them to the Play Store internal track'
lane :build_and_upload_trunk_internal do |options|
version_name = current_release_version

unless options[:skip_prechecks]
ensure_git_branch(branch: DEFAULT_BRANCH) unless is_ci

ensure_git_status_clean unless is_ci

UI.important("Building #{version_name} for upload to the Play Store internal track")

UI.user_error!('Aborted by user request') unless options[:skip_confirm] || UI.confirm('Do you want to continue?')

android_build_preflight
end

version = VERSION_FORMATTER.parse(version_name)
build_code = Fastlane::Wpmreleasetoolkit::Versioning::ContinuousBuildCodeFormatter.new.build_code(
major: version.major,
minor: version.minor,
build_number: Integer(ENV.fetch('BUILDKITE_BUILD_NUMBER'))
)

UI.important("Building trunk internal build: #{version_name} (#{build_code})")

# Set the version for this build only. We deliberately do not commit this change.
VERSION_FILE.write_version(version_name: version_name, version_code: build_code)

%i[wordpress jetpack].each do |app|
build_bundle(app: app, version_name: version_name, build_code: build_code, buildType: 'Release')
upload_build_to_play_store(app: app, version_name: version_name, track: 'internal')
# `upload_gutenberg_sourcemaps` builds a file path from the app name, so it needs a String
# (a Symbol can't be passed to `File.join`).
upload_gutenberg_sourcemaps(app: app.to_s, release_version: version_name)
end
end

#####################################################################################
# upload_build_to_play_store
# -----------------------------------------------------------------------------------
Expand Down
Loading