Skip to content
Merged
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
12 changes: 12 additions & 0 deletions .buildkite/commands/build-trunk-internal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -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
Comment thread
oguzkocer marked this conversation as resolved.
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"
57 changes: 57 additions & 0 deletions fastlane/lanes/build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,63 @@
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 |skip_prechecks: false, skip_confirm: false|
version_name = current_release_version

unless 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 skip_confirm || UI.confirm('Do you want to continue?')

android_build_preflight
end

build_number = ENV.fetch('BUILDKITE_BUILD_NUMBER') do
UI.user_error!('BUILDKITE_BUILD_NUMBER is not set; the versionCode derives from it (Buildkite only).')
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(build_number)
)

UI.important("Building #{DEFAULT_BRANCH} 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)
Comment on lines +165 to +167

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of scope, but this sounds like something upload_gutenberg_sourcemaps might want to handle internally. If nothing else, it would make the call site cleaner by being able to pass app directly.

end
end

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