dispatch-build-bottle: support Linux
This commit is contained in:
parent
9d62a13a31
commit
b3949f0765
@ -25,7 +25,10 @@ module Homebrew
|
|||||||
description: "Dispatch specified workflow (default: `dispatch-build-bottle.yml`)."
|
description: "Dispatch specified workflow (default: `dispatch-build-bottle.yml`)."
|
||||||
switch "--upload",
|
switch "--upload",
|
||||||
description: "Upload built bottles to Bintray."
|
description: "Upload built bottles to Bintray."
|
||||||
|
switch "--linux",
|
||||||
|
description: "Dispatch bottle for Linux (using GitHub runners)."
|
||||||
|
|
||||||
|
conflicts "--macos", "--linux"
|
||||||
named_args :formula, min: 1
|
named_args :formula, min: 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -33,18 +36,26 @@ module Homebrew
|
|||||||
def dispatch_build_bottle
|
def dispatch_build_bottle
|
||||||
args = dispatch_build_bottle_args.parse
|
args = dispatch_build_bottle_args.parse
|
||||||
|
|
||||||
|
tap = Tap.fetch(args.tap || CoreTap.instance.name)
|
||||||
|
user, repo = tap.full_name.split("/")
|
||||||
|
ref = "master"
|
||||||
|
workflow = args.workflow || "dispatch-build-bottle.yml"
|
||||||
|
|
||||||
|
# Ensure we dispatch the bottle in homebrew/homebrew-core
|
||||||
|
# TODO: remove when core taps are merged
|
||||||
|
repo.gsub!("linux", "home") unless args.tap
|
||||||
|
|
||||||
|
if (macos = args.macos)
|
||||||
# Fixup version for ARM/Apple Silicon
|
# Fixup version for ARM/Apple Silicon
|
||||||
# TODO: fix label name to be 11-arm64 instead and remove this.
|
# TODO: fix label name to be 11-arm64 instead and remove this.
|
||||||
args.macos&.gsub!(/^11-arm$/, "11-arm64")
|
macos.gsub!(/^11-arm$/, "11-arm64")
|
||||||
|
|
||||||
macos = args.macos&.yield_self do |s|
|
macos = macos.yield_self do |s|
|
||||||
MacOS::Version.from_symbol(s.to_sym)
|
MacOS::Version.from_symbol(s.to_sym)
|
||||||
rescue MacOSVersionError
|
rescue MacOSVersionError
|
||||||
MacOS::Version.new(s)
|
MacOS::Version.new(s)
|
||||||
end
|
end
|
||||||
|
|
||||||
raise UsageError, "Must specify --macos option" if macos.blank?
|
|
||||||
|
|
||||||
# Fixup label for ARM/Apple Silicon
|
# Fixup label for ARM/Apple Silicon
|
||||||
macos_label = if macos.arch == :arm64
|
macos_label = if macos.arch == :arm64
|
||||||
# TODO: fix label name to be 11-arm64 instead.
|
# TODO: fix label name to be 11-arm64 instead.
|
||||||
@ -53,25 +64,27 @@ module Homebrew
|
|||||||
macos.to_s
|
macos.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
tap = Tap.fetch(args.tap || CoreTap.instance.name)
|
dispatching_for = "macOS #{macos}"
|
||||||
user, repo = tap.full_name.split("/")
|
elsif T.unsafe(args).linux?
|
||||||
|
workflow = args.workflow || "linux-#{workflow}"
|
||||||
workflow = args.workflow || "dispatch-build-bottle.yml"
|
dispatching_for = "Linux"
|
||||||
ref = "master"
|
else
|
||||||
|
raise UsageError, "Must specify --macos or --linux option"
|
||||||
|
end
|
||||||
|
|
||||||
args.named.to_resolved_formulae.each do |formula|
|
args.named.to_resolved_formulae.each do |formula|
|
||||||
# Required inputs
|
# Required inputs
|
||||||
inputs = {
|
inputs = {
|
||||||
formula: formula.name,
|
formula: formula.name,
|
||||||
macos: macos_label,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Optional inputs
|
# Optional inputs
|
||||||
# These cannot be passed as nil to GitHub API
|
# These cannot be passed as nil to GitHub API
|
||||||
|
inputs[:macos] = macos_label if args.macos
|
||||||
inputs[:issue] = args.issue if args.issue
|
inputs[:issue] = args.issue if args.issue
|
||||||
inputs[:upload] = args.upload?.to_s if args.upload?
|
inputs[:upload] = args.upload?.to_s if args.upload?
|
||||||
|
|
||||||
ohai "Dispatching #{tap} bottling request of formula \"#{formula.name}\" for macOS #{macos}"
|
ohai "Dispatching #{tap} bottling request of formula \"#{formula.name}\" for #{dispatching_for}"
|
||||||
GitHub.workflow_dispatch_event(user, repo, workflow, ref, inputs)
|
GitHub.workflow_dispatch_event(user, repo, workflow, ref, inputs)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user