Skip to content

Commit 8e1a31b

Browse files
authored
Merge pull request #397 from wordpress-mobile/support/custom-milestone-duration
Support custom milestone duration
2 parents d136b4f + cad485b commit 8e1a31b

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_new_milestone_action.rb

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ def self.run(params)
1212
last_stone = Fastlane::Helper::GithubHelper.get_last_milestone(repository)
1313
UI.message("Last detected milestone: #{last_stone[:title]} due on #{last_stone[:due_on]}.")
1414
milestone_duedate = last_stone[:due_on]
15-
newmilestone_duedate = (milestone_duedate.to_datetime.next_day(14).to_time).utc
15+
milestone_duration = params[:milestone_duration]
16+
newmilestone_duedate = (milestone_duedate.to_datetime.next_day(milestone_duration).to_time).utc
1617
newmilestone_number = Fastlane::Helper::Ios::VersionHelper.calc_next_release_version(last_stone[:title])
18+
number_of_days_from_code_freeze_to_release = params[:number_of_days_from_code_freeze_to_release]
1719
UI.message("Next milestone: #{newmilestone_number} due on #{newmilestone_duedate}.")
18-
Fastlane::Helper::GithubHelper.create_milestone(repository, newmilestone_number, newmilestone_duedate, params[:need_appstore_submission])
20+
Fastlane::Helper::GithubHelper.create_milestone(repository, newmilestone_number, newmilestone_duedate, milestone_duration, number_of_days_from_code_freeze_to_release, params[:need_appstore_submission])
1921
end
2022

2123
def self.description
@@ -48,6 +50,18 @@ def self.available_options
4850
optional: true,
4951
is_string: false,
5052
default_value: false),
53+
FastlaneCore::ConfigItem.new(key: :milestone_duration,
54+
env_name: 'GHHELPER_MILESTONE_DURATION',
55+
description: 'Milestone duration in number of days',
56+
optional: true,
57+
is_string: false,
58+
default_value: 14),
59+
FastlaneCore::ConfigItem.new(key: :number_of_days_from_code_freeze_to_release,
60+
env_name: 'GHHELPER_NUMBER_OF_DAYS_FROM_CODE_FREEZE_TO_RELEASE',
61+
description: 'Number of days from code freeze to release',
62+
optional: true,
63+
is_string: false,
64+
default_value: 14),
5165
]
5266
end
5367

lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,13 @@ def self.get_last_milestone(repository)
8080
last_stone
8181
end
8282

83-
def self.create_milestone(repository, newmilestone_number, newmilestone_duedate, need_submission)
84-
submission_date = need_submission ? newmilestone_duedate.to_datetime.next_day(11) : newmilestone_duedate.to_datetime.next_day(14)
85-
release_date = newmilestone_duedate.to_datetime.next_day(14)
83+
def self.create_milestone(repository, newmilestone_number, newmilestone_duedate, newmilestone_duration, number_of_days_from_code_freeze_to_release, need_submission)
84+
# If there is a review process, we want to submit the binary 3 days before its release
85+
#
86+
# Using 3 days is mostly for historical reasons where we release the apps on Monday and submit them on Friday.
87+
days_until_submission = need_submission ? (number_of_days_from_code_freeze_to_release - 3) : newmilestone_duration
88+
submission_date = newmilestone_duedate.to_datetime.next_day(days_until_submission)
89+
release_date = newmilestone_duedate.to_datetime.next_day(number_of_days_from_code_freeze_to_release)
8690
comment = "Code freeze: #{newmilestone_duedate.to_datetime.strftime('%B %d, %Y')} App Store submission: #{submission_date.strftime('%B %d, %Y')} Release: #{release_date.strftime('%B %d, %Y')}"
8791

8892
options = {}

0 commit comments

Comments
 (0)