Class: GitHubReleases Private
Overview
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
GitHub Releases client.
Constant Summary collapse
- URL_REGEX =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
%r{https://github\.com/([\w-]+)/([\w-]+)?/releases/download/(.+)}
Instance Method Summary collapse
Methods included from Context
current, current=, #debug?, #quiet?, #verbose?, #with_context
Instance Method Details
#upload_bottles(bottles_hash) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'github_releases.rb', line 14 def upload_bottles(bottles_hash) bottles_hash.each_value do |bottle_hash| root_url = bottle_hash["bottle"]["root_url"] url_match = root_url.match URL_REGEX _, user, repo, tag = *url_match # Ensure a release is created. release = begin rel = GitHub.get_release user, repo, tag odebug "Existing GitHub release \"#{tag}\" found" rel rescue GitHub::API::HTTPNotFoundError odebug "Creating new GitHub release \"#{tag}\"" GitHub.create_or_update_release user, repo, tag end # Upload bottles as release assets. bottle_hash["bottle"]["tags"].each_value do |tag_hash| remote_file = tag_hash["filename"] local_file = tag_hash["local_filename"] odebug "Uploading #{remote_file}" GitHub.upload_release_asset user, repo, release["id"], local_file:, remote_file: end end end |