Skip to content

Publish and commit bottles #3823

Publish and commit bottles

Publish and commit bottles #3823

name: Publish and commit bottles
on:
workflow_dispatch:
inputs:
pull_request:
description: Pull request number
required: true
large_runner:
description: "Run the upload job on a large runner? (default: false)"
type: boolean
required: false
default: false
autosquash:
description: "Squash pull request commits according to Homebrew style? (default: false)"
type: boolean
required: false
default: false
warn_on_upload_failure:
description: "Pass `--warn-on-upload-failure` to `brew pr-pull`? (default: false)"
type: boolean
required: false
default: false
message:
description: "Message to include when autosquashing revision bumps, deletions, and rebuilds (requires autosquash)"
required: false
env:
HOMEBREW_DEVELOPER: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_FROM_API: 1
GH_REPO: ${{github.repository}}
GH_DEBUG: 1
GH_NO_UPDATE_NOTIFIER: 1
GH_PROMPT_DISABLED: 1
jobs:
upload:
runs-on: ubuntu-22.04
container:
image: ghcr.io/homebrew/ubuntu22.04:master
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
core: true
cask: false
test-bot: false
- name: Configure Git user
id: git-user-config
uses: Homebrew/actions/git-user-config@master
with:
username: BrewTestBot
- name: Pull bottles
env:
HOMEBREW_GITHUB_API_TOKEN: ${{secrets.GITHUB_TOKEN}}
HOMEBREW_GITHUB_PACKAGES_USER: ${{ github.repository_owner }}
HOMEBREW_GITHUB_PACKAGES_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
sudo sed -i 's/Closes ##{pr}/[skip ci]/g' "$(brew --repository)"/Library/Homebrew/dev-cmd/pr-pull.rb
# Don't quote arguments that might be empty; this causes errors.
brew pr-pull \
--debug \
--workflows=build.yml \
--tap=${{ github.repository_owner }}/extensions \
--root-url="https://ghcr.io/v2/${{ github.repository_owner }}/extensions" \
'${{inputs.autosquash && '--autosquash' || '--clean'}}' \
${{inputs.warn_on_upload_failure && '--warn-on-upload-failure' || ''}} \
${{inputs.message && format('--message="{0}"', inputs.message) || ''}} \
'${{github.event.inputs.pull_request}}'
- name: Merge PR branch
working-directory: ${{steps.set-up-homebrew.outputs.repository-path}}
run: bash .github/scripts/retry.sh 50 10 gh pr merge ${{github.event.inputs.pull_request}} --admin --delete-branch --rebase
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Push commits
uses: Homebrew/actions/git-try-push@master
with:
directory: ${{steps.set-up-homebrew.outputs.repository-path}}
token: ${{secrets.GITHUB_TOKEN}}