Class: ReleaseCeremony::Publish

Inherits:
Object
  • Object
show all
Extended by:
Command
Defined in:
lib/release_ceremony/publish.rb

Overview

Publishes a prepared, merged release: validates the merge commit, tags it, pushes the tag, watches the tag-triggered release workflow, and confirms the gem appears on RubyGems.

Constant Summary collapse

USAGE =
'Usage: release_ceremony publish VERSION'
HELP =
<<~TEXT.freeze
  #{USAGE}

  Validate and publish the merged release-vVERSION pull request by tagging
  its merge commit and monitoring the release workflow.
TEXT

Instance Method Summary collapse

Methods included from Command

run

Constructor Details

#initialize(version:, runner:, project: nil) ⇒ Publish

Returns a new instance of Publish.



18
19
20
21
22
# File 'lib/release_ceremony/publish.rb', line 18

def initialize(version:, runner:, project: nil)
  @version = version
  @runner = runner
  @project = project || Project.discover(runner: runner)
end

Instance Method Details

#callObject



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/release_ceremony/publish.rb', line 24

def call
  runner.run('git', 'fetch', '--no-tags', project.remote, project.default_branch)
  pull_request = merged_pull_request
  sha = pull_request.sha
  validate_release_commit!(sha)
  tags = tag_state
  validate_existing_tags!(tags, sha)
  print_summary(pull_request, tags)
  confirm!
  publish_tag(tags, sha)
  monitor_release(sha)
  true
end