Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 7 additions & 3 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ Dotenv.load(PROJECT_ENV_FILE_PATH)
GITHUB_REPO = 'wordpress-mobile/wordpress-iOS'
DEFAULT_BRANCH = 'trunk'
PUBLIC_CONFIG_FILE = File.join(PROJECT_ROOT_FOLDER, 'config', 'Version.public.xcconfig')
# Unfortunately, ios_current_branch_is_hotfix relies on this ENV var under the hood.
# We can't get rid of it just yet.
ENV['PUBLIC_CONFIG_FILE'] = PUBLIC_CONFIG_FILE
INTERNAL_CONFIG_FILE = File.join(PROJECT_ROOT_FOLDER, 'config', 'Version.internal.xcconfig')
ENV['FASTLANE_WWDR_USE_HTTP1_AND_RETRIES'] = 'true'

Expand Down Expand Up @@ -129,6 +126,13 @@ def release_version_next
VERSION_FORMATTER.release_version(next_calculated_release_version)
end

def release_is_hotfix?
# Read the current release version from the .xcconfig file and parse it into an AppVersion object
current_version = VERSION_FORMATTER.parse(VERSION_FILE.read_release_version)
Copy link
Contributor

Choose a reason for hiding this comment

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

This change caused a failure. I assume it was supposed to be PUBLIC_VERSION_FILE, so I made that change here.

cc @iangmaia

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it was supposed to be PUBLIC_VERSION_FILE

Indeed, that is the case. Thanks for changing it!

# Calculate and return whether the release version is a hotfix
VERSION_CALCULATOR.release_is_hotfix?(version: current_version)
end

# Returns the current build code of the app
#
def build_code_current
Expand Down
22 changes: 12 additions & 10 deletions fastlane/lanes/release.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
UI.user_error!('Aborted by user request') unless skip_user_confirmation || UI.confirm('Do you want to continue?')

generate_strings_file_for_glotpress
download_localized_strings_and_metadata(options)
download_localized_strings_and_metadata
lint_localizations(allow_retry: skip_user_confirmation == false)

bump_build_codes
Expand Down Expand Up @@ -381,17 +381,19 @@
end
end

# Finalizes a release at the end of a sprint to submit to the App Store
# Finalizes a release at the end of a sprint to submit to the App Store, triggering the final release build on CI
#
# - Updates store metadata
# - Bumps final version number
# - Removes branch protection and close milestone
# - Triggers the final release on CI
# This lane performs the following actions:
# - Updates store metadata
# - Bumps final version number
# - Removes branch protection and closes milestone
# - Triggers the final release on CI
#
# @option [Boolean] skip_confirm (default: false) If true, avoids any interactive prompt
# @param skip_confirm [Boolean] Whether to skip confirmation prompts
#
desc 'Trigger the final release build on CI'
lane :finalize_release do |options, skip_confirm: false|
lane :finalize_release do |skip_confirm: false|
UI.user_error!('To finalize a hotfix, please use the `finalize_hotfix_release` lane instead') if release_is_hotfix?
Copy link
Contributor

Choose a reason for hiding this comment

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

There's something about "release_is_hotfix?" that sounds odd.

I was going to suggest adding branch in the name, but that would be incorrect because the check is on the version file not the branch name.

Maybe current_version_is_hotfix? or is_hotfix?.

Not sure...

Copy link
Contributor Author

@iangmaia iangmaia Oct 17, 2024

Choose a reason for hiding this comment

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

I got this method from Woo, which seems to have its name based on a release-toolkit method, but I agree -- renamed to current_version_hotfix? on 38ac3e5.


ensure_git_branch_is_release_branch!
ensure_git_status_clean

Expand All @@ -400,7 +402,7 @@

check_all_translations(interactive: skip_confirm == false)

download_localized_strings_and_metadata(options)
download_localized_strings_and_metadata
lint_localizations(allow_retry: skip_confirm == false)

bump_build_codes
Expand Down