Class: Metanorma::Release::Platform::GitHub::Publisher

Inherits:
Object
  • Object
show all
Includes:
Metanorma::Release::Publisher
Defined in:
lib/metanorma/release/platform/github/publisher.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:, repo:) ⇒ Publisher

Returns a new instance of Publisher.



10
11
12
13
# File 'lib/metanorma/release/platform/github/publisher.rb', line 10

def initialize(client:, repo:)
  @client = client
  @repo = repo
end

Instance Method Details

#publish(tag, artifact, metadata, channels:, force_replace: false) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/metanorma/release/platform/github/publisher.rb', line 15

def publish(tag, artifact, , channels:, force_replace: false)
  tag_name = tag.to_s

  if force_replace
    delete_existing_release(tag_name)
    return create_release(tag_name, , artifact)
  end

  existing = find_release(tag_name)

  if existing
    update_release(existing, )
  else
    create_release(tag_name, , artifact)
  end
end