mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Merge pull request #7925 from dawidd6/dev-cmd-bottle
dev-cmd: add dispatch-build-bottle command
This commit is contained in:
commit
ffe7f2a8da
64
Library/Homebrew/dev-cmd/dispatch-build-bottle.rb
Normal file
64
Library/Homebrew/dev-cmd/dispatch-build-bottle.rb
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "cli/parser"
|
||||||
|
require "utils/github"
|
||||||
|
|
||||||
|
module Homebrew
|
||||||
|
module_function
|
||||||
|
|
||||||
|
def dispatch_build_bottle_args
|
||||||
|
Homebrew::CLI::Parser.new do
|
||||||
|
usage_banner <<~EOS
|
||||||
|
`dispatch-build-bottle` [<options>] <formula> [<formula> ...]
|
||||||
|
|
||||||
|
Build bottles for these formulae with GitHub Actions.
|
||||||
|
EOS
|
||||||
|
flag "--tap=",
|
||||||
|
description: "Target tap repository (default: `homebrew/core`)."
|
||||||
|
flag "--issue=",
|
||||||
|
description: "If specified, post a comment to this issue number if the job fails."
|
||||||
|
flag "--macos=",
|
||||||
|
description: "Version of macOS the bottle should be built for."
|
||||||
|
flag "--workflow=",
|
||||||
|
description: "Dispatch specified workflow (default: `dispatch-build-bottle.yml`)."
|
||||||
|
switch "--upload",
|
||||||
|
description: "Upload built bottles to Bintray."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def dispatch_build_bottle
|
||||||
|
args = dispatch_build_bottle_args.parse
|
||||||
|
|
||||||
|
raise FormulaUnspecifiedError if args.named.empty?
|
||||||
|
|
||||||
|
odie "Must specify --macos option" unless args.macos
|
||||||
|
|
||||||
|
macos = begin
|
||||||
|
MacOS::Version.from_symbol(args.macos.to_sym)
|
||||||
|
rescue MacOSVersionError
|
||||||
|
MacOS::Version.new(args.macos)
|
||||||
|
end
|
||||||
|
|
||||||
|
tap = Tap.fetch(args.tap || CoreTap.instance.name)
|
||||||
|
user, repo = tap.full_name.split("/")
|
||||||
|
|
||||||
|
workflow = args.workflow || "dispatch-build-bottle.yml"
|
||||||
|
ref = "master"
|
||||||
|
|
||||||
|
args.named.to_resolved_formulae.each do |formula|
|
||||||
|
# Required inputs
|
||||||
|
inputs = {
|
||||||
|
formula: formula.name,
|
||||||
|
macos: macos.to_s,
|
||||||
|
}
|
||||||
|
|
||||||
|
# Optional inputs
|
||||||
|
# These cannot be passed as nil to GitHub API
|
||||||
|
inputs[:issue] = args.issue if args.issue
|
||||||
|
inputs[:upload] = args.upload?.to_s if args.upload?
|
||||||
|
|
||||||
|
ohai "Dispatching #{tap} bottling request of formula \"#{formula.name}\" for macOS #{macos}"
|
||||||
|
GitHub.workflow_dispatch_event(user, repo, workflow, ref, inputs)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,7 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "cmd/shared_examples/args_parse"
|
||||||
|
|
||||||
|
describe "Homebrew.dispatch_build_bottle_args" do
|
||||||
|
it_behaves_like "parseable arguments"
|
||||||
|
end
|
@ -27,6 +27,7 @@ configure
|
|||||||
create
|
create
|
||||||
deps
|
deps
|
||||||
desc
|
desc
|
||||||
|
dispatch-build-bottle
|
||||||
diy
|
diy
|
||||||
doctor
|
doctor
|
||||||
dr
|
dr
|
||||||
|
@ -968,6 +968,21 @@ a simple example. For the complete API, see:
|
|||||||
* `-f`, `--force`:
|
* `-f`, `--force`:
|
||||||
Ignore errors for disallowed formula names and named that shadow aliases.
|
Ignore errors for disallowed formula names and named that shadow aliases.
|
||||||
|
|
||||||
|
### `dispatch-build-bottle` [*`options`*] *`formula`* [*`formula`* ...]
|
||||||
|
|
||||||
|
Build bottles for these formulae with GitHub Actions.
|
||||||
|
|
||||||
|
* `--tap`:
|
||||||
|
Target tap repository (default: `homebrew/core`).
|
||||||
|
* `--issue`:
|
||||||
|
If specified, post a comment to this issue number if the job fails.
|
||||||
|
* `--macos`:
|
||||||
|
Version of macOS the bottle should be built for.
|
||||||
|
* `--workflow`:
|
||||||
|
Dispatch specified workflow (default: `dispatch-build-bottle.yml`).
|
||||||
|
* `--upload`:
|
||||||
|
Upload built bottles to Bintray.
|
||||||
|
|
||||||
### `diy` [*`options`*]
|
### `diy` [*`options`*]
|
||||||
|
|
||||||
Automatically determine the installation prefix for non-Homebrew software.
|
Automatically determine the installation prefix for non-Homebrew software.
|
||||||
|
@ -1363,6 +1363,29 @@ Generate the new formula within the given tap, specified as \fIuser\fR\fB/\fR\fI
|
|||||||
\fB\-f\fR, \fB\-\-force\fR
|
\fB\-f\fR, \fB\-\-force\fR
|
||||||
Ignore errors for disallowed formula names and named that shadow aliases\.
|
Ignore errors for disallowed formula names and named that shadow aliases\.
|
||||||
.
|
.
|
||||||
|
.SS "\fBdispatch\-build\-bottle\fR [\fIoptions\fR] \fIformula\fR [\fIformula\fR \.\.\.]"
|
||||||
|
Build bottles for these formulae with GitHub Actions\.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
\fB\-\-tap\fR
|
||||||
|
Target tap repository (default: \fBhomebrew/core\fR)\.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
\fB\-\-issue\fR
|
||||||
|
If specified, post a comment to this issue number if the job fails\.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
\fB\-\-macos\fR
|
||||||
|
Version of macOS the bottle should be built for\.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
\fB\-\-workflow\fR
|
||||||
|
Dispatch specified workflow (default: \fBdispatch\-build\-bottle\.yml\fR)\.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
\fB\-\-upload\fR
|
||||||
|
Upload built bottles to Bintray\.
|
||||||
|
.
|
||||||
.SS "\fBdiy\fR [\fIoptions\fR]"
|
.SS "\fBdiy\fR [\fIoptions\fR]"
|
||||||
Automatically determine the installation prefix for non\-Homebrew software\. Using the output from this command, you can install your own software into the Cellar and then link it into Homebrew\'s prefix with \fBbrew link\fR\.
|
Automatically determine the installation prefix for non\-Homebrew software\. Using the output from this command, you can install your own software into the Cellar and then link it into Homebrew\'s prefix with \fBbrew link\fR\.
|
||||||
.
|
.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user