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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ _None_
- Replace `rspec-buildkite-analytics` with `buildkite-test_collector` (Buildkite renamed the gem) and update it to `2.2.0`. This is another internal-only change and is not a breaking change for clients. [#465]
- Adds `ignore_pipeline_branch_filters=true` parameter to the API call triggering a Buildkite build [#468]
- Replace all instances of `is_string` with `type` [#469]
- Use `git_branch_name_using_HEAD` instead of `git_branch` so that the return value is not modified by environment variables. This has no impact to our current release flow, that's why it's not in "Breaking changes" section. [#463]

## 7.0.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ def self.run(params)

require_relative '../../helper/android/android_version_helper'
require_relative '../../helper/android/android_git_helper'
require_relative '../../helper/git_helper'

UI.user_error!("Current branch - '#{other_action.git_branch}' - is not a release branch. Abort.") unless other_action.git_branch.start_with?('release/')
current_branch = Fastlane::Helper::GitHelper.current_git_branch
UI.user_error!("Current branch - '#{current_branch}' - is not a release branch. Abort.") unless current_branch.start_with?('release/')

version = Fastlane::Helper::Android::VersionHelper.get_public_version
message = "Completing code freeze for: #{version}\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ def self.run(params)

require_relative '../../helper/android/android_version_helper'
require_relative '../../helper/android/android_git_helper'
require_relative '../../helper/git_helper'

UI.user_error!('This is not a release branch. Abort.') unless other_action.git_branch.start_with?('release/')
current_branch = Fastlane::Helper::GitHelper.current_git_branch
UI.user_error!("Current branch - '#{current_branch}' - is not a release branch. Abort.") unless current_branch.start_with?('release/')

version = Fastlane::Helper::Android::VersionHelper.get_public_version
message = "Finalizing release: #{version}\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ def self.run(params)

require_relative '../../helper/ios/ios_version_helper'
require_relative '../../helper/ios/ios_git_helper'
require_relative '../../helper/git_helper'

UI.user_error!("Current branch - '#{other_action.git_branch}' - is not a release branch. Abort.") unless other_action.git_branch.start_with?('release/')
current_branch = Fastlane::Helper::GitHelper.current_git_branch
UI.user_error!("Current branch - '#{current_branch}' - is not a release branch. Abort.") unless current_branch.start_with?('release/')

version = Fastlane::Helper::Ios::VersionHelper.get_public_version
message = "Completing code freeze for: #{version}\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ def self.run(params)

require_relative '../../helper/ios/ios_version_helper'
require_relative '../../helper/ios/ios_git_helper'
require_relative '../../helper/git_helper'

UI.user_error!('This is not a release branch. Abort.') unless other_action.git_branch.start_with?('release/')
current_branch = Fastlane::Helper::GitHelper.current_git_branch
UI.user_error!("Current branch - '#{current_branch}' - is not a release branch. Abort.") unless current_branch.start_with?('release/')

version = Fastlane::Helper::Ios::VersionHelper.get_public_version
message = "Finalizing release: #{version}\n"
Expand Down
17 changes: 17 additions & 0 deletions lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,23 @@ def self.fetch_all_tags
Action.sh('git', 'fetch', '--tags')
end

# Returns the current git branch, or "HEAD" if it's not checked out to any branch
# Can NOT be replaced using the environment variables such as `GIT_BRANCH` or `BUILDKITE_BRANCH`
#
# `fastlane` already has a helper action for this called `git_branch`, however it's modified
# by CI environment variables. We need to check which branch we are actually on and not the
# initial branch a CI build is started from, so we are using the `git_branch_name_using_HEAD`
# helper instead.
#
# See https://docs.fastlane.tools/actions/git_branch/#git_branch
#
# @return [String] The current git branch, or "HEAD" if it's not checked out to any branch
#
def self.current_git_branch
# We can't use `other_action.git_branch`, because it is modified by environment variables in Buildkite.
Fastlane::Actions.git_branch_name_using_HEAD
end

# Checks if a branch exists locally.
#
# @param [String] branch_name The name of the branch to check for
Expand Down