Skip to content

Commit

Permalink
WIP 2/7 EOD
Browse files Browse the repository at this point in the history
  • Loading branch information
xsavvyx committed Feb 7, 2025
1 parent 2a1f878 commit 11280f9
Showing 1 changed file with 64 additions and 17 deletions.
81 changes: 64 additions & 17 deletions lib/discharger/steps/release.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,35 +77,82 @@ def push_to_production

@task.sysecho <<~MSG
Version #{current_version} released to production.
MSG

Preparing to bump the version for the next release.
prepare_next_version
end
end

def prepare_next_version
if mono_repo
@task.sysecho <<~MSG.bg(:yellow).black
Would you like to tag and release #{gem_tag} of the #{gem_name} gem?
Type 'y' to tag and release, or just press Enter to continue without.
MSG

@tasker["reissue"].invoke
new_version = Object.const_get(@task.version_constant)
new_version_branch = "bump/begin-#{new_version.tr(".", "-")}"
continue = @task.syscall(["git checkout -b #{new_version_branch}"])
input = $stdin.gets
should_tag_gem = input.chomp.match?(/^y/i)

abort "Bump failed." unless continue
if should_tag_gem
if @task.syscall(
["git tag #{gem_tag}"],
["git push --tags"]
)
@task.sysecho "Successfully tagged and pushed #{gem_tag}"
else
manually_push_tag_warning
end
end
end

pr_url = "#{@task.pull_request_url}/compare/#{@task.working_branch}...#{new_version_branch}?expand=1&title=Begin%20#{current_version}"
@task.sysecho <<~MSG
Preparing to bump the version for the next release.
@task.syscall(["git push origin #{new_version_branch} --force"]) do
@task.sysecho <<~MSG
Branch #{new_version_branch} created.
MSG

Open a PR to #{@task.working_branch} to mark the version and update the chaneglog
for the next release.
@tasker["reissue"].invoke
new_version = Object.const_get(@task.version_constant)
new_version_branch = "bump/begin-#{new_version.tr(".", "-")}"
continue = @task.syscall(["git checkout -b #{new_version_branch}"])

Opening PR: #{pr_url}
MSG
end.then do |success|
@task.syscall ["open #{pr_url}"] if success
end
abort "Bump failed." unless continue

pr_url = "#{@task.pull_request_url}/compare/#{@task.working_branch}...#{new_version_branch}?expand=1&title=Begin%20#{current_version}"
@task.syscall(["git push origin #{new_version_branch} --force"]) do
@task.sysecho <<~MSG
Branch #{new_version_branch} created.
Open a PR to #{@task.working_branch} to mark the version and update the chaneglog
for the next release.
Opening PR: #{pr_url}
MSG
end.then do |success|
@task.syscall ["open #{pr_url}"] if success
end
end

def manually_push_tag_warning
@task.sysecho <<~MSG.bg(:red)
Warning: Failed to tag and push #{gem_tag}
Release flow must continue, and tagging will need to be done manually.
Follow these steps:
1) Manually push the tags.
`git tag #{gem_tag}`
`git push --tags`
2) Verify
- go to the workflows page
- go to the gem page that lists versions
- confirm that the tag released
3) Prepare for the next release
- update the gem version file to the next version
- `bundle install`
- PR
MSG
end

def establish_config
@task.desc "Echo the configuration settings."
@task.task "#{@task.name}:config" do
Expand Down

0 comments on commit 11280f9

Please sign in to comment.