Skip to content

Commit

Permalink
Add release older version deploy flag
Browse files Browse the repository at this point in the history
  • Loading branch information
amk-stripe committed Dec 20, 2024
1 parent dd48576 commit 30cac54
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
6 changes: 6 additions & 0 deletions scripts/deploy/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
@step_index = 1
@is_dry_run = false
@deploy_branch = 'master'
@is_older_version = false

def execute_steps(steps, step_index)
step_count = steps.length
Expand Down Expand Up @@ -55,6 +56,11 @@ def execute_steps(steps, step_index)
opts.on('--branch BRANCH', "Branch to deploy from") do |t|
@deploy_branch = t
end

opts.on('--release-older-version', "Indicates you are not releasing the newest version of stripe-android.") do |t|
@is_older_version = t
end

end.parse!

steps = [
Expand Down
5 changes: 5 additions & 0 deletions scripts/deploy/update_dokka.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
require_relative 'common'

def generate_dokka()
if (@is_older_version)
rputs "Skipping updating dokka because this release is for an older version."
return
end

dokka_change_description = "Generate dokka for #{@version}"

begin
Expand Down
5 changes: 5 additions & 0 deletions scripts/deploy/update_pay_server_docs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
require_relative 'common'

def update_pay_server_docs()
if (@is_older_version)
rputs "Skipping updating pay server docs because this release is for an older version."
return
end

puts 'Ensuring pay-server repo is up-to-date.'
begin
execute_or_fail("git -C ../pay-server checkout master")
Expand Down
8 changes: 6 additions & 2 deletions scripts/deploy/validate_version_number.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,15 @@ def get_current_version()
def validate_target_version_is_newer(target_version)
current_version = get_current_version()
if !target_version_is_newer(target_version, current_version)
raise "Expected target version #{target_version} to be newer than #{current_version}."
raise "Expected target version #{target_version} to be newer than #{current_version}. If
the new version number is intentionally older, pass the `--release-older-version` flag to
the deploy script."
end
end

def validate_version_number()
validate_version_number_format(@version)
validate_target_version_is_newer(@version)
if (!@is_older_version)
validate_target_version_is_newer(@version)
end
end

0 comments on commit 30cac54

Please sign in to comment.