From 77d2a036a71146a5fb99894959eec45d4d92f900 Mon Sep 17 00:00:00 2001 From: Andy Valdez Date: Wed, 11 Sep 2024 15:31:10 -0400 Subject: [PATCH 01/14] Add message to allow user to login manually in the enter email screen. --- .../authentication/SignInFragment.kt | 16 +++++++++++ .../automattic/simplenote/utils/StrUtils.java | 28 +++++++++++++++++++ .../src/main/res/layout/fragment_login.xml | 17 ++++++++++- Simplenote/src/main/res/values/strings.xml | 2 ++ 4 files changed, 62 insertions(+), 1 deletion(-) diff --git a/Simplenote/src/main/java/com/automattic/simplenote/authentication/SignInFragment.kt b/Simplenote/src/main/java/com/automattic/simplenote/authentication/SignInFragment.kt index 47c547d51..0cb73cb2a 100644 --- a/Simplenote/src/main/java/com/automattic/simplenote/authentication/SignInFragment.kt +++ b/Simplenote/src/main/java/com/automattic/simplenote/authentication/SignInFragment.kt @@ -2,14 +2,17 @@ package com.automattic.simplenote.authentication import android.app.Activity import android.content.Intent +import android.graphics.Color import android.net.Uri import android.os.Bundle +import android.text.method.LinkMovementMethod import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.Button import android.widget.EditText +import android.widget.TextView import android.widget.Toast import androidx.activity.result.contract.ActivityResultContracts import androidx.fragment.app.viewModels @@ -101,6 +104,17 @@ class SignInFragment: MagicLinkableFragment() { "wpcc_button_press_signin_activity" ) } + val manualLoginTextView = view.findViewById(R.id.sign_in_login_manually) + val message = getString(R.string.signin_login_with_email_manually); + val span = StrUtils.generateClickableSpannableString(LOGIN_MANUALLY_SUBSTRING, message + ) { + val email = getEmailEditText() + showLoginWithPassword(activity, email?.text?.toString()) + } + + manualLoginTextView.text = span + manualLoginTextView.movementMethod = LinkMovementMethod.getInstance() + manualLoginTextView.highlightColor = Color.TRANSPARENT return view } @@ -154,6 +168,8 @@ class SignInFragment: MagicLinkableFragment() { } companion object { + const val LOGIN_MANUALLY_SUBSTRING = "log in manually" + fun showLoginWithPassword(activity: Activity?, username: String?) { activity?.let { act -> val intent = Intent(act, NewCredentialsActivity::class.java) diff --git a/Simplenote/src/main/java/com/automattic/simplenote/utils/StrUtils.java b/Simplenote/src/main/java/com/automattic/simplenote/utils/StrUtils.java index 081ea7548..1da35f6b9 100644 --- a/Simplenote/src/main/java/com/automattic/simplenote/utils/StrUtils.java +++ b/Simplenote/src/main/java/com/automattic/simplenote/utils/StrUtils.java @@ -7,8 +7,14 @@ import static androidx.core.util.PatternsCompat.EMAIL_ADDRESS; +import android.text.SpannableString; import android.text.Spanned; +import android.text.TextPaint; import android.text.TextUtils; +import android.text.style.ClickableSpan; +import android.view.View; + +import androidx.annotation.NonNull; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; @@ -134,4 +140,26 @@ public static Spanned setTextToUpperCaseAndBold(String originalString) { return HtmlCompat.fromHtml("" + originalString.toUpperCase() + ""); } + + public static SpannableString generateClickableSpannableString(final String targetString, final String text, final View.OnClickListener onClickListener) { + final SpannableString spannableString = new SpannableString(text); + final int startIndex = text.indexOf(targetString); + if (startIndex == -1) { + return spannableString; + } + final int endIndex = startIndex + targetString.length(); + spannableString.setSpan(new ClickableSpan() { + @Override + public void onClick(@NonNull View widget) { + onClickListener.onClick(widget); + } + + @Override + public void updateDrawState(@NonNull TextPaint ds) { + super.updateDrawState(ds); + ds.setUnderlineText(false); + } + }, startIndex, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + return spannableString; + } } diff --git a/Simplenote/src/main/res/layout/fragment_login.xml b/Simplenote/src/main/res/layout/fragment_login.xml index 1585c0c14..06bba18eb 100644 --- a/Simplenote/src/main/res/layout/fragment_login.xml +++ b/Simplenote/src/main/res/layout/fragment_login.xml @@ -45,7 +45,22 @@ android:textAllCaps="true" android:textColor="@android:color/white" /> - + + + Enter password We\'ve sent a code to \n%1$s. The code will be valid for a few minutes. Enter the password for the account %1$s + + We\'ll email you a code to log in, or you can log in manually. From f1a36ae0f60c2c70dd4a512f31222aa1ff14369c Mon Sep 17 00:00:00 2001 From: Andy Valdez Date: Fri, 13 Sep 2024 17:37:06 -0400 Subject: [PATCH 02/14] Change using spans directly and use html.toHtml instead. --- .../authentication/SignInFragment.kt | 21 ++++++++------ .../automattic/simplenote/utils/StrUtils.java | 28 ------------------- Simplenote/src/main/res/values/strings.xml | 2 +- 3 files changed, 14 insertions(+), 37 deletions(-) diff --git a/Simplenote/src/main/java/com/automattic/simplenote/authentication/SignInFragment.kt b/Simplenote/src/main/java/com/automattic/simplenote/authentication/SignInFragment.kt index 0cb73cb2a..d0072d96f 100644 --- a/Simplenote/src/main/java/com/automattic/simplenote/authentication/SignInFragment.kt +++ b/Simplenote/src/main/java/com/automattic/simplenote/authentication/SignInFragment.kt @@ -5,6 +5,7 @@ import android.content.Intent import android.graphics.Color import android.net.Uri import android.os.Bundle +import android.text.Html import android.text.method.LinkMovementMethod import android.util.Log import android.view.LayoutInflater @@ -15,6 +16,7 @@ import android.widget.EditText import android.widget.TextView import android.widget.Toast import androidx.activity.result.contract.ActivityResultContracts +import androidx.core.content.ContextCompat import androidx.fragment.app.viewModels import com.automattic.simplenote.R import com.automattic.simplenote.Simplenote @@ -105,16 +107,19 @@ class SignInFragment: MagicLinkableFragment() { ) } val manualLoginTextView = view.findViewById(R.id.sign_in_login_manually) - val message = getString(R.string.signin_login_with_email_manually); - val span = StrUtils.generateClickableSpannableString(LOGIN_MANUALLY_SUBSTRING, message - ) { + context?.let { + val colorLink = Integer.toHexString(ContextCompat.getColor(it, R.color.text_link) and 16777215) + manualLoginTextView.text = Html.fromHtml( + String.format( + getString(R.string.signin_login_with_email_manually), + "", "" + ) + ) + } + manualLoginTextView.setOnClickListener { val email = getEmailEditText() showLoginWithPassword(activity, email?.text?.toString()) } - - manualLoginTextView.text = span - manualLoginTextView.movementMethod = LinkMovementMethod.getInstance() - manualLoginTextView.highlightColor = Color.TRANSPARENT return view } @@ -169,7 +174,7 @@ class SignInFragment: MagicLinkableFragment() { companion object { const val LOGIN_MANUALLY_SUBSTRING = "log in manually" - + fun showLoginWithPassword(activity: Activity?, username: String?) { activity?.let { act -> val intent = Intent(act, NewCredentialsActivity::class.java) diff --git a/Simplenote/src/main/java/com/automattic/simplenote/utils/StrUtils.java b/Simplenote/src/main/java/com/automattic/simplenote/utils/StrUtils.java index 1da35f6b9..081ea7548 100644 --- a/Simplenote/src/main/java/com/automattic/simplenote/utils/StrUtils.java +++ b/Simplenote/src/main/java/com/automattic/simplenote/utils/StrUtils.java @@ -7,14 +7,8 @@ import static androidx.core.util.PatternsCompat.EMAIL_ADDRESS; -import android.text.SpannableString; import android.text.Spanned; -import android.text.TextPaint; import android.text.TextUtils; -import android.text.style.ClickableSpan; -import android.view.View; - -import androidx.annotation.NonNull; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; @@ -140,26 +134,4 @@ public static Spanned setTextToUpperCaseAndBold(String originalString) { return HtmlCompat.fromHtml("" + originalString.toUpperCase() + ""); } - - public static SpannableString generateClickableSpannableString(final String targetString, final String text, final View.OnClickListener onClickListener) { - final SpannableString spannableString = new SpannableString(text); - final int startIndex = text.indexOf(targetString); - if (startIndex == -1) { - return spannableString; - } - final int endIndex = startIndex + targetString.length(); - spannableString.setSpan(new ClickableSpan() { - @Override - public void onClick(@NonNull View widget) { - onClickListener.onClick(widget); - } - - @Override - public void updateDrawState(@NonNull TextPaint ds) { - super.updateDrawState(ds); - ds.setUnderlineText(false); - } - }, startIndex, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - return spannableString; - } } diff --git a/Simplenote/src/main/res/values/strings.xml b/Simplenote/src/main/res/values/strings.xml index 5f78704bc..741878017 100644 --- a/Simplenote/src/main/res/values/strings.xml +++ b/Simplenote/src/main/res/values/strings.xml @@ -452,5 +452,5 @@ We\'ve sent a code to \n%1$s. The code will be valid for a few minutes. Enter the password for the account %1$s - We\'ll email you a code to log in, or you can log in manually. + We\'ll email you a code to log in, or you can %1$s%2$s%3$slog in manually%4$s. From aebb6a333dee89c3cc472afabb8d9debb9f9ee6a Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Fri, 13 Sep 2024 15:01:42 +1000 Subject: [PATCH 03/14] Remove out-of-date parameter from `download_metadata_strings` call --- fastlane/Fastfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 7fadc813d..cf7972c68 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -196,7 +196,7 @@ platform :android do build_code = build_code_current UI.success("Done! Final release version: #{version}. Final build code: #{build_code}.") - download_metadata_strings(version: version, build_number: build_code) + download_metadata_strings UI.important('Will push changes to remote and trigger the release build.') UI.user_error!("Terminating as requested. Don't forget to run the remainder of this automation manually.") unless skip_confirm || UI.confirm('Do you want to continue?') From 7d5fd2ce348fda074cf2f5a28f09ed4d4c781e39 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Mon, 16 Sep 2024 16:48:27 +1000 Subject: [PATCH 04/14] =?UTF-8?q?Remove=20`ci=5Freleases.rb`=20=E2=80=93?= =?UTF-8?q?=20We=20decided=20not=20to=20track=20them?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastlane/lanes/ci_releases.rb | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 fastlane/lanes/ci_releases.rb diff --git a/fastlane/lanes/ci_releases.rb b/fastlane/lanes/ci_releases.rb deleted file mode 100644 index c59892f45..000000000 --- a/fastlane/lanes/ci_releases.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -PIPELINES_ROOT = 'release-pipelines' - -platform :ios do - lane :trigger_code_freeze_in_ci do - buildkite_trigger_build( - buildkite_organization: BUILDKITE_ORGANIZATION, - buildkite_pipeline: BUILDKITE_PIPELINE, - branch: DEFAULT_BRANCH, - pipeline_file: File.join(PIPELINES_ROOT, 'start-code-freeze.yml'), - message: 'Start Code Freeze' - ) - end - - lane :trigger_complete_code_freeze_in_ci do |release_version: release_version_current| - buildkite_trigger_build( - buildkite_organization: BUILDKITE_ORGANIZATION, - buildkite_pipeline: BUILDKITE_PIPELINE, - branch: release_branch_name(release_version: release_version), - pipeline_file: File.join(PIPELINES_ROOT, 'complete-code-freeze.yml'), - message: "Complete code freeze for #{release_version}", - environment: { RELEASE_VERSION: release_version } - ) - end -end From c38e3c6f70db004dcc4531d04e6ea97323aeae3a Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Tue, 17 Sep 2024 11:19:51 +1000 Subject: [PATCH 05/14] Move `finalize_release` to `fastlane/lanes/release.rb` --- fastlane/Fastfile | 58 --------------------------------------- fastlane/lanes/release.rb | 58 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 58 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index cf7972c68..8d1793615 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -169,64 +169,6 @@ platform :android do trigger_release_build(branch_to_build: release_branch_name) end - desc 'Updates store metadata and runs the release checks' - lane :finalize_release do |skip_confirm: false| - UI.user_error!('Please use `finalize_hotfix_release` lane for hotfixes') if android_current_branch_is_hotfix(version_properties_path: VERSION_PROPERTIES_PATH) - - ensure_git_status_clean - ensure_git_branch_is_release_branch! - - UI.important("Finalizing release: #{release_version_current}") - UI.user_error!("Terminating as requested. Don't forget to run the remainder of this automation manually.") unless skip_confirm || UI.confirm('Do you want to continue?') - - configure_apply(force: is_ci) - - check_translation_progress_all unless is_ci - download_translations - - UI.message 'Bumping final release version and build code...' - VERSION_FILE.write_version( - version_name: release_version_current, - version_code: build_code_next - ) - commit_version_bump - - # Print computed version and build to let user double-check outcome in logs - version = release_version_current - build_code = build_code_current - UI.success("Done! Final release version: #{version}. Final build code: #{build_code}.") - - download_metadata_strings - - UI.important('Will push changes to remote and trigger the release build.') - UI.user_error!("Terminating as requested. Don't forget to run the remainder of this automation manually.") unless skip_confirm || UI.confirm('Do you want to continue?') - - push_to_git_remote(tags: false) - - build_and_upload_release(create_release: true) - - create_release_backmerge_pr(version_to_merge: version, next_version: release_version_next) - - remove_branch_protection( - repository: GITHUB_REPO, - branch: release_branch_name - ) - - begin - set_milestone_frozen_marker( - repository: GITHUB_REPO, - milestone: version, - freeze: false - ) - close_milestone( - repository: GITHUB_REPO, - milestone: version - ) - rescue StandardError => e - report_milestone_error(error_title: "Error in milestone finalization process for `#{version}`: #{e.message}") - end - end - desc 'Build a Prototype Build and make it available for download' lane :build_and_upload_prototype_build do UI.user_error!("'BUILDKITE_ARTIFACTS_S3_BUCKET' must be defined as an environment variable.") unless ENV['BUILDKITE_ARTIFACTS_S3_BUCKET'] diff --git a/fastlane/lanes/release.rb b/fastlane/lanes/release.rb index 53d11a112..fde64d5ab 100644 --- a/fastlane/lanes/release.rb +++ b/fastlane/lanes/release.rb @@ -122,6 +122,64 @@ buildkite_annotate(context: 'code-freeze-completed', style: 'success', message: message) end + desc 'Updates store metadata and runs the release checks' + lane :finalize_release do |skip_confirm: false| + UI.user_error!('Please use `finalize_hotfix_release` lane for hotfixes') if android_current_branch_is_hotfix(version_properties_path: VERSION_PROPERTIES_PATH) + + ensure_git_status_clean + ensure_git_branch_is_release_branch! + + UI.important("Finalizing release: #{release_version_current}") + UI.user_error!("Terminating as requested. Don't forget to run the remainder of this automation manually.") unless skip_confirm || UI.confirm('Do you want to continue?') + + configure_apply(force: is_ci) + + check_translation_progress_all unless is_ci + download_translations + + UI.message 'Bumping final release version and build code...' + VERSION_FILE.write_version( + version_name: release_version_current, + version_code: build_code_next + ) + commit_version_bump + + # Print computed version and build to let user double-check outcome in logs + version = release_version_current + build_code = build_code_current + UI.success("Done! Final release version: #{version}. Final build code: #{build_code}.") + + download_metadata_strings + + UI.important('Will push changes to remote and trigger the release build.') + UI.user_error!("Terminating as requested. Don't forget to run the remainder of this automation manually.") unless skip_confirm || UI.confirm('Do you want to continue?') + + push_to_git_remote(tags: false) + + build_and_upload_release(create_release: true) + + create_release_backmerge_pr(version_to_merge: version, next_version: release_version_next) + + remove_branch_protection( + repository: GITHUB_REPO, + branch: release_branch_name + ) + + begin + set_milestone_frozen_marker( + repository: GITHUB_REPO, + milestone: version, + freeze: false + ) + close_milestone( + repository: GITHUB_REPO, + milestone: version + ) + rescue StandardError => e + report_milestone_error(error_title: "Error in milestone finalization process for `#{version}`: #{e.message}") + end + end + lane :trigger_beta_build do |branch_to_build:| trigger_buildkite_release_build(branch: branch_to_build, beta: true) end From ec7a563ec76d850cf7ea276740b82fb0cadb0921 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Tue, 17 Sep 2024 11:51:38 +1000 Subject: [PATCH 06/14] Replace `create_release_management_pull_request` with new backmerge --- fastlane/lanes/release.rb | 80 ++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 35 deletions(-) diff --git a/fastlane/lanes/release.rb b/fastlane/lanes/release.rb index fde64d5ab..c9d706eab 100644 --- a/fastlane/lanes/release.rb +++ b/fastlane/lanes/release.rb @@ -108,18 +108,13 @@ trigger_beta_build(branch_to_build: release_branch_name(release_version: version)) - pr_url = create_release_management_pull_request( - release_version: version, - base_branch: DEFAULT_BRANCH, - title: "Merge #{version} code freeze" - ) - - next unless is_ci + pr_url = create_backmerge_pr! message = <<~MESSAGE Code freeze completed successfully. Next, review and merge the [integration PR](#{pr_url}). MESSAGE - buildkite_annotate(context: 'code-freeze-completed', style: 'success', message: message) + buildkite_annotate(context: 'code-freeze-completed', style: 'success', message: message) if is_ci + UI.success(message) end desc 'Updates store metadata and runs the release checks' @@ -158,7 +153,15 @@ build_and_upload_release(create_release: true) - create_release_backmerge_pr(version_to_merge: version, next_version: release_version_next) + pr_url = create_backmerge_pr! + + message = <<~MESSAGE + Release finalized successfully. Next, review and merge the [integration PR](#{pr_url}). + MESSAGE + buildkite_annotate(context: 'finalize-release-completed', style: 'success', message: message) if is_ci + UI.success(message) + + UI.message('Attempting to remove release branch protection in GitHub...') remove_branch_protection( repository: GITHUB_REPO, @@ -261,36 +264,43 @@ def report_milestone_error(error_title:) buildkite_annotate(style: 'warning', context: 'error-with-milestone', message: error_message) if is_ci end -def create_release_management_pull_request(release_version:, base_branch:, title:) - # TODO: Adopt shared EnvManager ASAP. See https://github.com/wordpress-mobile/release-toolkit/pull/578 - # token = EnvManager.get_required_env!('GITHUB_TOKEN') - token = ENV.fetch('GITHUB_TOKEN', nil) - UI.user_error!('No GITHUB_TOKEN found in the environment.') if token.nil? - - pr_url = create_pull_request( - api_token: token, - repo: GITHUB_REPO, - title: title, - head: Fastlane::Helper::GitHelper.current_git_branch, - base: base_branch, - labels: 'Releases' - ) +def create_backmerge_pr! + pr_urls = create_backmerge_prs! - # Next, set the milestone for the PR - # - # The create_pull_request action has a 'milestone' parameter, but it expects the milestone id. - # We don't know the id of the milestone, but we can use a different action to set it. - # - # PR URLs are in the format github.com/org/repo/pull/id - pr_number = File.basename(pr_url) - update_assigned_milestone( + return pr_urls unless pr_urls.length > 1 + + backmerge_error_message = UI.user_error! <<~ERROR + Unexpectedly opened more than one backmerge pull request. URLs: + #{pr_urls.map { |url| "- #{url}" }.join("\n")} + ERROR + buildkite_annotate(style: 'error', context: 'error-creating-backmerge', message: backmerge_error_message) if is_ci + UI.user_error!(backmerge_error_message) +end + +# Notice the plural in the name. +# The action this method calls may create multiple backmerge PRs, depending on how many release branches with version greater than the source are in the remote. +def create_backmerge_prs! + version = release_version_current + + create_release_backmerge_pull_request( repository: GITHUB_REPO, - numbers: [pr_number], - to_milestone: release_version + source_branch: release_branch_name(release_version: version), + labels: ['Releases'], + milestone_title: release_version_next ) +rescue StandardError => e + error_message = <<-MESSAGE + Error creating backmerge pull request(s): + + #{e.message} + + If this is not the first time you are running the release task, the backmerge PR(s) for the version `#{version}` might have already been previously created. + Please close any pre-existing backmerge PR for `#{version}`, delete the previous merge branch, then run the release task again. + MESSAGE + + buildkite_annotate(style: 'error', context: 'error-creating-backmerge', message: error_message) if is_ci - # Return the PR URL - pr_url + UI.user_error!(error_message) end def trigger_buildkite_release_build(branch:, beta:) From 1a5436c696038daa31b661d74531ccf1d8c5f975 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Tue, 17 Sep 2024 12:02:07 +1000 Subject: [PATCH 07/14] Add `publish_release` lane Base off https://github.com/woocommerce/woocommerce-android/pull/12450 --- fastlane/lanes/release.rb | 61 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/fastlane/lanes/release.rb b/fastlane/lanes/release.rb index c9d706eab..474fcbb11 100644 --- a/fastlane/lanes/release.rb +++ b/fastlane/lanes/release.rb @@ -183,6 +183,59 @@ end end + lane :publish_release do |skip_confirm: false| + ensure_git_status_clean + ensure_git_branch_is_release_branch! + + version_number = release_version_current + + current_branch = release_branch_name(release_version: version_number) + next_release_branch = release_branch_name(release_version: release_version_next) + + UI.important <<~PROMPT + Publish the #{version_number} release. This will: + - Publish the existing draft `#{version_number}` release on GitHub + - Which will also have GitHub create the associated Git tag, pointing to the tip of #{current_branch} + - If the release branch for the next version `#{next_release_branch}` already exists, backmerge `#{current_branch}` into it + - If needed, backmerge `#{current_branch}` back into `#{DEFAULT_BRANCH}` + - Delete the `#{current_branch}` branch + PROMPT + UI.user_error!("Terminating as requested. Don't forget to run the remainder of this automation manually.") unless skip_confirm || UI.confirm('Do you want to continue?') + + UI.important "Publishing release #{version_number} on GitHub..." + + publish_github_release( + repository: GITHUB_REPO, + name: version_number + ) + + pr_urls = create_backmerge_prs! + + # It's possible that no backmerge was created when: + # + # - there are no hotfixes in development and the next release code freeze has not been started + # - nothing changes in the current release branch since release finalization + # + # As a matter of fact, in the context of Simplenote Android, the above is the most likely scenario. + style, message = if pr_urls.empty? + ['info', 'No backmerge PR was required'] + else + [ + 'success', <<~MESSAGE + The following backmerge PR#{pr_urls.length > 1 ? '(s) were' : ' was'} created: + #{pr_urls.map { |url| "- #{url}" }} + MESSAGE + ] + end + buildkite_annotate(style: style, context: 'backmerge-prs-outcome', message: message) if is_ci + UI.success(message) + + # At this point, an intermediate branch has been created by creating a backmerge PR to a hotfix or the next version release branch. + # This allows us to safely delete the `release/*` branch. + # Note that if a hotfix or new release branches haven't been created, the backmerge PR won't be created as well. + delete_remote_git_branch!(current_branch) + end + lane :trigger_beta_build do |branch_to_build:| trigger_buildkite_release_build(branch: branch_to_build, beta: true) end @@ -335,3 +388,11 @@ def delete_old_changelogs_and_commit(version:) allow_nothing_to_commit: true ) end + +# Delete a branch from the GitHub remote, after having removed any GitHub branch protection. +# +def delete_remote_git_branch!(branch_name, remote: 'origin') + remove_branch_protection(repository: GITHUB_REPO, branch: branch_name) + + Git.open(Dir.pwd).push(remote, branch_name, delete: true) +end From ffc4b507b84e2e89dc014a0587465a4b5ed506b1 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Tue, 17 Sep 2024 12:05:59 +1000 Subject: [PATCH 08/14] Add Buildkite pipelines to finalize and publish releases in CI --- .../release-pipelines/finalize-release.yml | 24 +++++++++++++++++++ .../release-pipelines/publish-release.yml | 24 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 .buildkite/release-pipelines/finalize-release.yml create mode 100644 .buildkite/release-pipelines/publish-release.yml diff --git a/.buildkite/release-pipelines/finalize-release.yml b/.buildkite/release-pipelines/finalize-release.yml new file mode 100644 index 000000000..ff8407bae --- /dev/null +++ b/.buildkite/release-pipelines/finalize-release.yml @@ -0,0 +1,24 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json +--- + +steps: + - label: Finalize Release + plugins: [$CI_TOOLKIT_PLUGIN] + command: | + echo '--- :robot_face: Use bot for git operations' + source use-bot-for-git + + echo '--- :git: Checkout Release Branch' + .buildkite/commands/checkout-release-branch.sh + + echo '--- :ruby: Set up Ruby Tools' + install_gems + + echo '--- :shipit: Finalize Release' + bundle exec fastlane finalize_release skip_confirm:true + agents: + queue: tumblr-metal + retry: + manual: + # If those jobs fail, one should always prefer re-triggering a new build from ReleaseV2 rather than retrying the individual job from Buildkite + allowed: false diff --git a/.buildkite/release-pipelines/publish-release.yml b/.buildkite/release-pipelines/publish-release.yml new file mode 100644 index 000000000..14c2ae5f3 --- /dev/null +++ b/.buildkite/release-pipelines/publish-release.yml @@ -0,0 +1,24 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json +--- + +steps: + - label: Publish Release + plugins: [$CI_TOOLKIT_plugin] + command: | + echo '--- :robot_face: Use bot for git operations' + source use-bot-for-git + + echo '--- :git: Checkout Release Branch' + .buildkite/commands/checkout-release-branch.sh + + echo '--- :ruby: Setup Ruby Tools' + install_gems + + echo '--- :package: Publish Release' + bundle exec fastlane publish_release skip_confirm:true + agents: + queue: tumblr-metal + retry: + manual: + # If those jobs fail, one should always prefer re-triggering a new build from ReleaseV2 rather than retrying the individual job from Buildkite + allowed: false From 2f69029b5df58ff2a9c32949d3cbb378189a7958 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Thu, 19 Sep 2024 14:15:23 +1000 Subject: [PATCH 09/14] Explicitly pass `wpmobilebot` to secure agent command Clearly the change adding Simplenote Android has not been deployed yet. --- .buildkite/release-pipelines/finalize-release.yml | 2 +- .buildkite/release-pipelines/publish-release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.buildkite/release-pipelines/finalize-release.yml b/.buildkite/release-pipelines/finalize-release.yml index ff8407bae..834388233 100644 --- a/.buildkite/release-pipelines/finalize-release.yml +++ b/.buildkite/release-pipelines/finalize-release.yml @@ -6,7 +6,7 @@ steps: plugins: [$CI_TOOLKIT_PLUGIN] command: | echo '--- :robot_face: Use bot for git operations' - source use-bot-for-git + source use-bot-for-git wpmobilebot echo '--- :git: Checkout Release Branch' .buildkite/commands/checkout-release-branch.sh diff --git a/.buildkite/release-pipelines/publish-release.yml b/.buildkite/release-pipelines/publish-release.yml index 14c2ae5f3..83bd789b3 100644 --- a/.buildkite/release-pipelines/publish-release.yml +++ b/.buildkite/release-pipelines/publish-release.yml @@ -6,7 +6,7 @@ steps: plugins: [$CI_TOOLKIT_plugin] command: | echo '--- :robot_face: Use bot for git operations' - source use-bot-for-git + source use-bot-for-git wpmobilebot echo '--- :git: Checkout Release Branch' .buildkite/commands/checkout-release-branch.sh From c358ba1922d95445336fb46fe40887d5dbb949ec Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Thu, 19 Sep 2024 14:23:03 +1000 Subject: [PATCH 10/14] Update translations --- Simplenote/src/main/res/values-fr/strings.xml | 3 ++- Simplenote/src/main/res/values-id/strings.xml | 3 ++- Simplenote/src/main/res/values-it/strings.xml | 5 +++-- Simplenote/src/main/res/values-ja/strings.xml | 3 ++- Simplenote/src/main/res/values-nl/strings.xml | 3 ++- Simplenote/src/main/res/values-pt-rBR/strings.xml | 3 ++- Simplenote/src/main/res/values-ru/strings.xml | 3 ++- Simplenote/src/main/res/values-sv/strings.xml | 3 ++- Simplenote/src/main/res/values-tr/strings.xml | 3 ++- Simplenote/src/main/res/values-zh-rCN/strings.xml | 3 ++- Simplenote/src/main/res/values-zh-rTW/strings.xml | 3 ++- 11 files changed, 23 insertions(+), 12 deletions(-) diff --git a/Simplenote/src/main/res/values-fr/strings.xml b/Simplenote/src/main/res/values-fr/strings.xml index b3d295013..80923e1b3 100644 --- a/Simplenote/src/main/res/values-fr/strings.xml +++ b/Simplenote/src/main/res/values-fr/strings.xml @@ -1,11 +1,12 @@ + Saisir le mot de passe associé au compte %1$s Nous avons envoyé un code à \n%1$s. Ce code sera valide pendant quelques minutes. Saisir le mot de passe Ou diff --git a/Simplenote/src/main/res/values-id/strings.xml b/Simplenote/src/main/res/values-id/strings.xml index 38b7e0923..90fcc9161 100644 --- a/Simplenote/src/main/res/values-id/strings.xml +++ b/Simplenote/src/main/res/values-id/strings.xml @@ -1,11 +1,12 @@ + Masukkan kata sandi untuk akun %1$s Kami telah mengirimkan kode ke \n%1$s. Kode ini valid selama beberapa menit. Masukkan kata sandi Atau diff --git a/Simplenote/src/main/res/values-it/strings.xml b/Simplenote/src/main/res/values-it/strings.xml index 8699a8a7a..b54c9edf4 100644 --- a/Simplenote/src/main/res/values-it/strings.xml +++ b/Simplenote/src/main/res/values-it/strings.xml @@ -1,11 +1,12 @@ + Digita la password per l\'account %1$s Abbiamo inviato un codice a \n%1$s. Il codice sarà valido per pochi minuti. Inserisci password Oppure @@ -372,7 +373,7 @@ Language: it Modifica i tag Caratteri Parole - Dimensione carattere + Dimensione font Rileva link Account Nuova nota diff --git a/Simplenote/src/main/res/values-ja/strings.xml b/Simplenote/src/main/res/values-ja/strings.xml index 3cae1acb4..64623db9a 100644 --- a/Simplenote/src/main/res/values-ja/strings.xml +++ b/Simplenote/src/main/res/values-ja/strings.xml @@ -1,11 +1,12 @@ + アカウント %1$s のパスワードを入力 コードを \n に送信しました%1$s。 コードは数分間有効です。 パスワードを入力 または diff --git a/Simplenote/src/main/res/values-nl/strings.xml b/Simplenote/src/main/res/values-nl/strings.xml index 79a7961af..cc517d481 100644 --- a/Simplenote/src/main/res/values-nl/strings.xml +++ b/Simplenote/src/main/res/values-nl/strings.xml @@ -1,11 +1,12 @@ + Voer het wachtwoord van het account %1$s in We hebben een code gestuurd naar \n%1$s. De code is een paar minuten geldig. Voer wachtwoord in Of diff --git a/Simplenote/src/main/res/values-pt-rBR/strings.xml b/Simplenote/src/main/res/values-pt-rBR/strings.xml index a01122cf5..fbe5e8879 100644 --- a/Simplenote/src/main/res/values-pt-rBR/strings.xml +++ b/Simplenote/src/main/res/values-pt-rBR/strings.xml @@ -1,11 +1,12 @@ + Digite a senha da conta %1$s Enviamos um código para \n%1$s. O código será válido por alguns minutos. Digite a senha Ou diff --git a/Simplenote/src/main/res/values-ru/strings.xml b/Simplenote/src/main/res/values-ru/strings.xml index dd382a3c9..7950264c7 100644 --- a/Simplenote/src/main/res/values-ru/strings.xml +++ b/Simplenote/src/main/res/values-ru/strings.xml @@ -1,11 +1,12 @@ + Введите пароль учётной записи %1$s Код отправлен на адрес \n%1$s. Код будет действителен в течение нескольких минут. Введите пароль или diff --git a/Simplenote/src/main/res/values-sv/strings.xml b/Simplenote/src/main/res/values-sv/strings.xml index 2ed1747dd..f001776fa 100644 --- a/Simplenote/src/main/res/values-sv/strings.xml +++ b/Simplenote/src/main/res/values-sv/strings.xml @@ -1,11 +1,12 @@ + Ange lösenordet för kontot %1$s Vi har skickat en kod till \n%1$s. Koden kommer vara giltig i några minuter. Ange lösenord Eller diff --git a/Simplenote/src/main/res/values-tr/strings.xml b/Simplenote/src/main/res/values-tr/strings.xml index 39dbe4262..f990521d2 100644 --- a/Simplenote/src/main/res/values-tr/strings.xml +++ b/Simplenote/src/main/res/values-tr/strings.xml @@ -1,11 +1,12 @@ + %1$s hesabınızın şifresini girin Şuraya bir kod gönderildi: \n%1$s. Kod birkaç dakikalığına geçerli olacak. Şifre girin Veya diff --git a/Simplenote/src/main/res/values-zh-rCN/strings.xml b/Simplenote/src/main/res/values-zh-rCN/strings.xml index 3924a9ab6..356250dc5 100644 --- a/Simplenote/src/main/res/values-zh-rCN/strings.xml +++ b/Simplenote/src/main/res/values-zh-rCN/strings.xml @@ -1,11 +1,12 @@ + 输入账户 %1$s 的密码 我们已向 \n 发送代码%1$s。 此代码将在几分钟后失效。 输入密码 diff --git a/Simplenote/src/main/res/values-zh-rTW/strings.xml b/Simplenote/src/main/res/values-zh-rTW/strings.xml index e94b5a755..e53d9e492 100644 --- a/Simplenote/src/main/res/values-zh-rTW/strings.xml +++ b/Simplenote/src/main/res/values-zh-rTW/strings.xml @@ -1,11 +1,12 @@ + 輸入 %1$s 帳號的密碼 我們已傳送驗證碼到 \n%1$s。 此驗證碼在幾分鐘內有效。 輸入密碼 From 851e61fa90ff4c45f56d7e6909e2eabf310708ba Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Thu, 19 Sep 2024 14:23:03 +1000 Subject: [PATCH 11/14] Bump version name and build code --- version.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.properties b/version.properties index 8ca320d76..7b7417198 100644 --- a/version.properties +++ b/version.properties @@ -1,2 +1,2 @@ -versionName=2.34-rc-1 -versionCode=170 \ No newline at end of file +versionName=2.34 +versionCode=171 \ No newline at end of file From 45a82014148e74982e6959d485f1d7fd1e0386bf Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Thu, 19 Sep 2024 14:23:09 +1000 Subject: [PATCH 12/14] Update metadata translations for 2.34 --- fastlane/metadata/android/fr-FR/changelogs/default.txt | 2 ++ fastlane/metadata/android/id/changelogs/default.txt | 2 ++ fastlane/metadata/android/it-IT/changelogs/default.txt | 2 ++ fastlane/metadata/android/ja-JP/changelogs/default.txt | 2 ++ fastlane/metadata/android/nl-NL/changelogs/default.txt | 2 ++ fastlane/metadata/android/pt-BR/changelogs/default.txt | 2 ++ fastlane/metadata/android/ru-RU/changelogs/default.txt | 2 ++ fastlane/metadata/android/sv-SE/changelogs/default.txt | 2 ++ fastlane/metadata/android/tr-TR/changelogs/default.txt | 2 ++ fastlane/metadata/android/zh-CN/changelogs/default.txt | 2 ++ fastlane/metadata/android/zh-TW/changelogs/default.txt | 2 ++ 11 files changed, 22 insertions(+) create mode 100644 fastlane/metadata/android/fr-FR/changelogs/default.txt create mode 100644 fastlane/metadata/android/id/changelogs/default.txt create mode 100644 fastlane/metadata/android/it-IT/changelogs/default.txt create mode 100644 fastlane/metadata/android/ja-JP/changelogs/default.txt create mode 100644 fastlane/metadata/android/nl-NL/changelogs/default.txt create mode 100644 fastlane/metadata/android/pt-BR/changelogs/default.txt create mode 100644 fastlane/metadata/android/ru-RU/changelogs/default.txt create mode 100644 fastlane/metadata/android/sv-SE/changelogs/default.txt create mode 100644 fastlane/metadata/android/tr-TR/changelogs/default.txt create mode 100644 fastlane/metadata/android/zh-CN/changelogs/default.txt create mode 100644 fastlane/metadata/android/zh-TW/changelogs/default.txt diff --git a/fastlane/metadata/android/fr-FR/changelogs/default.txt b/fastlane/metadata/android/fr-FR/changelogs/default.txt new file mode 100644 index 000000000..5c914eb4e --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/default.txt @@ -0,0 +1,2 @@ +2.34 : +Des améliorations sous le capot diff --git a/fastlane/metadata/android/id/changelogs/default.txt b/fastlane/metadata/android/id/changelogs/default.txt new file mode 100644 index 000000000..4047f58be --- /dev/null +++ b/fastlane/metadata/android/id/changelogs/default.txt @@ -0,0 +1,2 @@ +2.34: +Berbagai penyempurnaan di balik layar diff --git a/fastlane/metadata/android/it-IT/changelogs/default.txt b/fastlane/metadata/android/it-IT/changelogs/default.txt new file mode 100644 index 000000000..5ecc14fec --- /dev/null +++ b/fastlane/metadata/android/it-IT/changelogs/default.txt @@ -0,0 +1,2 @@ +2.34: +Miglioramenti sotto il cofano diff --git a/fastlane/metadata/android/ja-JP/changelogs/default.txt b/fastlane/metadata/android/ja-JP/changelogs/default.txt new file mode 100644 index 000000000..9e8dc4da0 --- /dev/null +++ b/fastlane/metadata/android/ja-JP/changelogs/default.txt @@ -0,0 +1,2 @@ +2.34: +内部の改良 diff --git a/fastlane/metadata/android/nl-NL/changelogs/default.txt b/fastlane/metadata/android/nl-NL/changelogs/default.txt new file mode 100644 index 000000000..43bfcc25b --- /dev/null +++ b/fastlane/metadata/android/nl-NL/changelogs/default.txt @@ -0,0 +1,2 @@ +2.34: +Verbeteringen onder de motorkap diff --git a/fastlane/metadata/android/pt-BR/changelogs/default.txt b/fastlane/metadata/android/pt-BR/changelogs/default.txt new file mode 100644 index 000000000..d82392c64 --- /dev/null +++ b/fastlane/metadata/android/pt-BR/changelogs/default.txt @@ -0,0 +1,2 @@ +2.34: +Melhorias no sistema diff --git a/fastlane/metadata/android/ru-RU/changelogs/default.txt b/fastlane/metadata/android/ru-RU/changelogs/default.txt new file mode 100644 index 000000000..ff885edfe --- /dev/null +++ b/fastlane/metadata/android/ru-RU/changelogs/default.txt @@ -0,0 +1,2 @@ +2.34: +Целый мешок усовершенствований. diff --git a/fastlane/metadata/android/sv-SE/changelogs/default.txt b/fastlane/metadata/android/sv-SE/changelogs/default.txt new file mode 100644 index 000000000..b0e55c66f --- /dev/null +++ b/fastlane/metadata/android/sv-SE/changelogs/default.txt @@ -0,0 +1,2 @@ +2.34: +Förbättringar under huven diff --git a/fastlane/metadata/android/tr-TR/changelogs/default.txt b/fastlane/metadata/android/tr-TR/changelogs/default.txt new file mode 100644 index 000000000..224e1b187 --- /dev/null +++ b/fastlane/metadata/android/tr-TR/changelogs/default.txt @@ -0,0 +1,2 @@ +2.34: +Arka planda yapılan iyileştirmeler. diff --git a/fastlane/metadata/android/zh-CN/changelogs/default.txt b/fastlane/metadata/android/zh-CN/changelogs/default.txt new file mode 100644 index 000000000..58514f4ce --- /dev/null +++ b/fastlane/metadata/android/zh-CN/changelogs/default.txt @@ -0,0 +1,2 @@ +2.34: +后台进行的改进。 diff --git a/fastlane/metadata/android/zh-TW/changelogs/default.txt b/fastlane/metadata/android/zh-TW/changelogs/default.txt new file mode 100644 index 000000000..8666d5108 --- /dev/null +++ b/fastlane/metadata/android/zh-TW/changelogs/default.txt @@ -0,0 +1,2 @@ +2.34: +內部的強化項目。 From adc8fefb75a4304ff19842a102817b3ae3758924 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Thu, 19 Sep 2024 15:55:08 +1000 Subject: [PATCH 13/14] Remove unnecessary `version` parameter --- fastlane/lanes/build.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/fastlane/lanes/build.rb b/fastlane/lanes/build.rb index 55a899265..929517ec1 100644 --- a/fastlane/lanes/build.rb +++ b/fastlane/lanes/build.rb @@ -75,7 +75,6 @@ version = VERSION_FILE.read_version_name build_and_upload_apk( - version: version, upload_track: beta ? 'beta' : 'production' ) From 10300495e8faaa7f2fc3bc770e465118c14b7e4a Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Thu, 19 Sep 2024 16:29:06 +1000 Subject: [PATCH 14/14] Do not remove branch protection in `finalize_release` `publish_release` does it for us now. --- fastlane/lanes/release.rb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/fastlane/lanes/release.rb b/fastlane/lanes/release.rb index 474fcbb11..1647feb1b 100644 --- a/fastlane/lanes/release.rb +++ b/fastlane/lanes/release.rb @@ -163,11 +163,6 @@ UI.message('Attempting to remove release branch protection in GitHub...') - remove_branch_protection( - repository: GITHUB_REPO, - branch: release_branch_name - ) - begin set_milestone_frozen_marker( repository: GITHUB_REPO,