homebrew-core/.github/workflows/dispatch-rebottle.yml

180 lines
6.1 KiB
YAML
Raw Normal View History

name: Dispatch rebottle
on:
workflow_dispatch:
inputs:
formula:
description: Formula name
required: true
issue:
description: Issue number, where comment on failure would be posted
required: false
upload:
description: "Whether to upload built bottles or not (default: false)"
required: false
env:
HOMEBREW_DEVELOPER: 1
HOMEBREW_GITHUB_ACTIONS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_CHANGE_ARCH_TO_ARM: 1
HOMEBREW_RELOCATE_RPATHS: 1
jobs:
bottle:
strategy:
matrix:
version: ["11-arm64", "11", "10.15", "10.14"]
fail-fast: false
runs-on: ${{ matrix.version }}
timeout-minutes: 4320
env:
PATH: "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED: 1
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: 1
steps:
- name: ${{github.event.inputs.formula}}
id: print_details
run: |
echo sender=${{github.event.sender.login}}
echo formula=${{github.event.inputs.formula}}
echo issue=${{github.event.inputs.issue}}
echo upload=${{github.event.inputs.upload}}
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- run: brew test-bot --only-cleanup-before
- run: brew test-bot --only-setup
- name: Run brew test-bot --only-json-tab --only-formulae
env:
HOMEBREW_GITHUB_API_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
mkdir bottles
cd bottles
brew test-bot --only-json-tab --only-formulae ${{github.event.inputs.formula}}
- name: Output brew test-bot --only-json-tab --only-formulae failures
if: always()
run: |
cat bottles/steps_output.txt
rm bottles/steps_output.txt
- name: Output brew bottle result
if: always()
run: |
cat bottles/bottle_output.txt
rm bottles/bottle_output.txt
- name: Upload logs
if: failure()
uses: actions/upload-artifact@main
with:
name: logs
path: bottles/logs
- name: Delete logs and home
if: always()
run: |
rm -rvf bottles/logs
rm -rvf bottles/home
- name: Count bottles
id: bottles
if: always()
run: |
cd bottles
count=$(ls *.json | wc -l | xargs echo -n)
echo "$count bottles"
echo "::set-output name=count::$count"
- name: Upload bottles to GitHub Actions
if: always() && steps.bottles.outputs.count > 0
uses: actions/upload-artifact@main
with:
name: bottles
path: bottles
- run: brew test-bot --only-cleanup-after
if: always()
- name: Post Cleanup
if: always()
run: rm -rvf bottles
- name: Post comment on failure
if: ${{!success() && github.event.inputs.issue > 0}}
uses: Homebrew/actions/post-comment@master
with:
token: ${{secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN}}
issue: ${{github.event.inputs.issue}}
body: ":x: @${{github.actor}} bottle request for ${{github.event.inputs.formula}} [failed](${{github.event.repository.html_url}}/actions/runs/${{github.run_id}})."
bot_body: ":x: Bottle request for ${{github.event.inputs.formula}} [failed](${{github.event.repository.html_url}}/actions/runs/${{github.run_id}})."
bot: BrewTestBot
upload:
runs-on: ubuntu-latest
needs: bottle
if: github.event.inputs.upload
env:
HOMEBREW_FORCE_HOMEBREW_ON_LINUX: 1
steps:
- name: ${{github.event.inputs.formula}}
id: print_details
run: |
echo sender=${{github.event.sender.login}}
echo formula=${{github.event.inputs.formula}}
echo version=${{github.event.inputs.macos}}
echo issue=${{github.event.inputs.issue}}
echo upload=${{github.event.inputs.upload}}
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Download bottles from GitHub Actions
uses: actions/download-artifact@main
with:
name: bottles
path: ~/bottles/
- name: Setup git
uses: Homebrew/actions/git-user-config@master
- name: Set up commit signing
uses: Homebrew/actions/setup-commit-signing@master
with:
signing_key: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY }}
- name: Upload bottles to GitHub Packages
env:
HOMEBREW_GITHUB_PACKAGES_USER: brewtestbot
HOMEBREW_GITHUB_PACKAGES_TOKEN: ${{secrets.HOMEBREW_CORE_GITHUB_PACKAGES_TOKEN}}
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
BREWTESTBOT_NAME_EMAIL: "BrewTestBot <1589480+BrewTestBot@users.noreply.github.com>"
run: |
cd ~/bottles
brew pr-upload --verbose --committer="$BREWTESTBOT_NAME_EMAIL" --root-url="https://ghcr.io/v2/homebrew/core" --debug
- name: Push commits
uses: Homebrew/actions/git-try-push@master
with:
token: ${{secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN}}
env:
GIT_COMMITTER_NAME: BrewTestBot
GIT_COMMITTER_EMAIL: 1589480+BrewTestBot@users.noreply.github.com
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
- name: Post comment on failure
if: ${{!success() && github.event.inputs.issue > 0}}
uses: Homebrew/actions/post-comment@master
with:
2021-04-08 06:39:37 +00:00
token: ${{secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN}}
issue: ${{github.event.inputs.issue}}
body: ":x: @${{github.actor}} bottle request for ${{github.event.inputs.formula}} [failed](${{github.event.repository.html_url}}/actions/runs/${{github.run_id}})."
bot_body: ":x: Bottle request for ${{github.event.inputs.formula}} [failed](${{github.event.repository.html_url}}/actions/runs/${{github.run_id}})."
bot: BrewTestBot