From ccc4d1a4d2a26707952f914e66c4511d5347e134 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Tue, 23 Jul 2024 20:39:04 +1000 Subject: [PATCH] Publish binary bottles using Homebrew standard workflows (#44) --- .github/workflows/publish.yml | 38 +++++++++++++++++++++++++++++++++++ .github/workflows/tests.yml | 27 ++++++++----------------- 2 files changed, 46 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..80f1afb --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,38 @@ +name: brew pr-pull + +on: + pull_request_target: + types: + - labeled + +jobs: + pr-pull: + if: contains(github.event.pull_request.labels.*.name, 'pr-pull') + runs-on: ubuntu-22.04 + permissions: + contents: write + pull-requests: write + steps: + - name: Set up Homebrew + uses: Homebrew/actions/setup-homebrew@40e9946c182a64b3db1bf51be0dcb915f7802aa9 + + - name: Set up git + uses: Homebrew/actions/git-user-config@c62170a03ff2bcb9ab097fd7d6acbc905618e42a + + - name: Pull bottles + env: + HOMEBREW_GITHUB_API_TOKEN: ${{ github.token }} + PULL_REQUEST: ${{ github.event.pull_request.number }} + run: brew pr-pull --debug --tap="$GITHUB_REPOSITORY" "$PULL_REQUEST" + + - name: Push commits + uses: Homebrew/actions/git-try-push@c62170a03ff2bcb9ab097fd7d6acbc905618e42a + with: + token: ${{ github.token }} + branch: main + + - name: Delete branch + if: github.event.pull_request.head.repo.fork == false + env: + BRANCH: ${{ github.event.pull_request.head.ref }} + run: git push --delete origin "$BRANCH" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 04aa5fb..4f24abb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,29 +22,20 @@ jobs: test-bot: strategy: matrix: - os: [ubuntu-22.04, macos-12] + os: [ubuntu-22.04, macos-13, macos-14] runs-on: ${{ matrix.os }} steps: - name: Set up Homebrew id: set-up-homebrew - uses: Homebrew/actions/setup-homebrew@86fe8bfcc0e2130aa1679d6bf1ff0323eecd8191 - - - name: Set up git - uses: Homebrew/actions/git-user-config@86fe8bfcc0e2130aa1679d6bf1ff0323eecd8191 + uses: Homebrew/actions/setup-homebrew@40e9946c182a64b3db1bf51be0dcb915f7802aa9 - name: Cache Homebrew Bundler RubyGems id: cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.set-up-homebrew.outputs.gems-path }} - key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} - restore-keys: ${{ runner.os }}-rubygems- - - - run: brew update - - - name: Install Homebrew Bundler RubyGems - if: steps.cache.outputs.cache-hit != 'true' - run: brew install-bundler-gems + key: ${{ matrix.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} + restore-keys: ${{ matrix.os }}-rubygems- - run: brew test-bot --only-cleanup-before @@ -52,14 +43,12 @@ jobs: - run: brew test-bot --only-tap-syntax - - run: brew test-bot --only-formulae --root-url 'https://ghcr.io/v2/stellar/homebrew-tap' - env: - HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - run: brew test-bot --only-formulae if: github.event_name == 'pull_request' - name: Upload bottles as artifact if: always() && github.event_name == 'pull_request' - uses: actions/upload-artifact@main + uses: actions/upload-artifact@v4 with: - name: bottles + name: bottles_${{ matrix.os }} path: '*.bottle.*'