GitHub Packages CI upload fixes

- Add `--no-commit` option to `brew pr-pull` and pass to
  `brew pr-upload`
- Use `skopeo` from `PATH` if available (as it takes a while to build on
  CI)
This commit is contained in:
Mike McQuaid 2021-04-02 16:47:56 +01:00
parent f266acff2d
commit 0ec1f04e63
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
7 changed files with 28 additions and 12 deletions

View File

@ -22,10 +22,12 @@ module Homebrew
EOS EOS
switch "--no-publish", switch "--no-publish",
description: "Download the bottles, apply the bottle commit and "\ description: "Download the bottles, apply the bottle commit and "\
"upload the bottles to Bintray, but don't publish them." "upload the bottles, but don't publish them."
switch "--no-upload", switch "--no-upload",
description: "Download the bottles and apply the bottle commit, "\ description: "Download the bottles and apply the bottle commit, "\
"but don't upload to Bintray or GitHub Releases." "but don't upload."
switch "--no-commit",
description: "Do not generate a new commit before uploading."
switch "-n", "--dry-run", switch "-n", "--dry-run",
description: "Print what would be done rather than doing it." description: "Print what would be done rather than doing it."
switch "--clean", switch "--clean",
@ -431,6 +433,7 @@ module Homebrew
upload_args = ["pr-upload"] upload_args = ["pr-upload"]
upload_args << "--debug" if args.debug? upload_args << "--debug" if args.debug?
upload_args << "--verbose" if args.verbose? upload_args << "--verbose" if args.verbose?
upload_args << "--no-commit" if args.no_commit?
upload_args << "--no-publish" if args.no_publish? upload_args << "--no-publish" if args.no_publish?
upload_args << "--dry-run" if args.dry_run? upload_args << "--dry-run" if args.dry_run?
upload_args << "--keep-old" if args.keep_old? upload_args << "--keep-old" if args.keep_old?

View File

@ -51,7 +51,11 @@ class GitHubPackages
raise UsageError, "HOMEBREW_GITHUB_PACKAGES_USER is unset." if user.blank? raise UsageError, "HOMEBREW_GITHUB_PACKAGES_USER is unset." if user.blank?
raise UsageError, "HOMEBREW_GITHUB_PACKAGES_TOKEN is unset." if token.blank? raise UsageError, "HOMEBREW_GITHUB_PACKAGES_TOKEN is unset." if token.blank?
skopeo = HOMEBREW_PREFIX/"bin/skopeo" skopeo = [
which("skopeo"),
which("skopeo", ENV["HOMEBREW_PATH"]),
HOMEBREW_PREFIX/"bin/skopeo",
].compact.first
unless skopeo.exist? unless skopeo.exist?
ohai "Installing `skopeo` for upload..." ohai "Installing `skopeo` for upload..."
safe_system HOMEBREW_BREW_FILE, "install", "--formula", "skopeo" safe_system HOMEBREW_BREW_FILE, "install", "--formula", "skopeo"

View File

@ -1464,6 +1464,7 @@ _brew_pr_pull() {
--ignore-missing-artifacts --ignore-missing-artifacts
--keep-old --keep-old
--message --message
--no-commit
--no-publish --no-publish
--no-upload --no-upload
--quiet --quiet

View File

@ -1058,8 +1058,9 @@ __fish_brew_complete_arg 'pr-pull' -l help -d 'Show this message'
__fish_brew_complete_arg 'pr-pull' -l ignore-missing-artifacts -d 'Comma-separated list of workflows which can be ignored if they have not been run' __fish_brew_complete_arg 'pr-pull' -l ignore-missing-artifacts -d 'Comma-separated list of workflows which can be ignored if they have not been run'
__fish_brew_complete_arg 'pr-pull' -l keep-old -d 'If the formula specifies a rebuild version, attempt to preserve its value in the generated DSL' __fish_brew_complete_arg 'pr-pull' -l keep-old -d 'If the formula specifies a rebuild version, attempt to preserve its value in the generated DSL'
__fish_brew_complete_arg 'pr-pull' -l message -d 'Message to include when autosquashing revision bumps, deletions, and rebuilds' __fish_brew_complete_arg 'pr-pull' -l message -d 'Message to include when autosquashing revision bumps, deletions, and rebuilds'
__fish_brew_complete_arg 'pr-pull' -l no-publish -d 'Download the bottles, apply the bottle commit and upload the bottles to Bintray, but don\'t publish them' __fish_brew_complete_arg 'pr-pull' -l no-commit -d 'Do not generate a new commit before uploading'
__fish_brew_complete_arg 'pr-pull' -l no-upload -d 'Download the bottles and apply the bottle commit, but don\'t upload to Bintray or GitHub Releases' __fish_brew_complete_arg 'pr-pull' -l no-publish -d 'Download the bottles, apply the bottle commit and upload the bottles, but don\'t publish them'
__fish_brew_complete_arg 'pr-pull' -l no-upload -d 'Download the bottles and apply the bottle commit, but don\'t upload'
__fish_brew_complete_arg 'pr-pull' -l quiet -d 'Make some output more quiet' __fish_brew_complete_arg 'pr-pull' -l quiet -d 'Make some output more quiet'
__fish_brew_complete_arg 'pr-pull' -l resolve -d 'When a patch fails to apply, leave in progress and allow user to resolve, instead of aborting' __fish_brew_complete_arg 'pr-pull' -l resolve -d 'When a patch fails to apply, leave in progress and allow user to resolve, instead of aborting'
__fish_brew_complete_arg 'pr-pull' -l root-url -d 'Use the specified URL as the root of the bottle\'s URL instead of Homebrew\'s default' __fish_brew_complete_arg 'pr-pull' -l root-url -d 'Use the specified URL as the root of the bottle\'s URL instead of Homebrew\'s default'

View File

@ -1301,8 +1301,9 @@ _brew_pr_pull() {
'--ignore-missing-artifacts[Comma-separated list of workflows which can be ignored if they have not been run]' \ '--ignore-missing-artifacts[Comma-separated list of workflows which can be ignored if they have not been run]' \
'--keep-old[If the formula specifies a rebuild version, attempt to preserve its value in the generated DSL]' \ '--keep-old[If the formula specifies a rebuild version, attempt to preserve its value in the generated DSL]' \
'--message[Message to include when autosquashing revision bumps, deletions, and rebuilds]' \ '--message[Message to include when autosquashing revision bumps, deletions, and rebuilds]' \
'--no-publish[Download the bottles, apply the bottle commit and upload the bottles to Bintray, but don'\''t publish them]' \ '--no-commit[Do not generate a new commit before uploading]' \
'--no-upload[Download the bottles and apply the bottle commit, but don'\''t upload to Bintray or GitHub Releases]' \ '--no-publish[Download the bottles, apply the bottle commit and upload the bottles, but don'\''t publish them]' \
'--no-upload[Download the bottles and apply the bottle commit, but don'\''t upload]' \
'--quiet[Make some output more quiet]' \ '--quiet[Make some output more quiet]' \
'--resolve[When a patch fails to apply, leave in progress and allow user to resolve, instead of aborting]' \ '--resolve[When a patch fails to apply, leave in progress and allow user to resolve, instead of aborting]' \
'--root-url[Use the specified URL as the root of the bottle'\''s URL instead of Homebrew'\''s default]' \ '--root-url[Use the specified URL as the root of the bottle'\''s URL instead of Homebrew'\''s default]' \

View File

@ -1168,9 +1168,11 @@ pull request with artifacts generated by GitHub Actions.
Requires write access to the repository. Requires write access to the repository.
* `--no-publish`: * `--no-publish`:
Download the bottles, apply the bottle commit and upload the bottles to Bintray, but don't publish them. Download the bottles, apply the bottle commit and upload the bottles, but don't publish them.
* `--no-upload`: * `--no-upload`:
Download the bottles and apply the bottle commit, but don't upload to Bintray or GitHub Releases. Download the bottles and apply the bottle commit, but don't upload.
* `--no-commit`:
Do not generate a new commit before uploading.
* `-n`, `--dry-run`: * `-n`, `--dry-run`:
Print what would be done rather than doing it. Print what would be done rather than doing it.
* `--clean`: * `--clean`:

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BREW" "1" "March 2021" "Homebrew" "brew" .TH "BREW" "1" "April 2021" "Homebrew" "brew"
. .
.SH "NAME" .SH "NAME"
\fBbrew\fR \- The Missing Package Manager for macOS (or Linux) \fBbrew\fR \- The Missing Package Manager for macOS (or Linux)
@ -1622,11 +1622,15 @@ Download and publish bottles, and apply the bottle commit from a pull request wi
. .
.TP .TP
\fB\-\-no\-publish\fR \fB\-\-no\-publish\fR
Download the bottles, apply the bottle commit and upload the bottles to Bintray, but don\'t publish them\. Download the bottles, apply the bottle commit and upload the bottles, but don\'t publish them\.
. .
.TP .TP
\fB\-\-no\-upload\fR \fB\-\-no\-upload\fR
Download the bottles and apply the bottle commit, but don\'t upload to Bintray or GitHub Releases\. Download the bottles and apply the bottle commit, but don\'t upload\.
.
.TP
\fB\-\-no\-commit\fR
Do not generate a new commit before uploading\.
. .
.TP .TP
\fB\-n\fR, \fB\-\-dry\-run\fR \fB\-n\fR, \fB\-\-dry\-run\fR