Skip to content

Commit

Permalink
ci: back to 3rd party actions for homebrew
Browse files Browse the repository at this point in the history
  • Loading branch information
nikaro committed Aug 27, 2024
1 parent e6539ed commit 0fccc52
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 51 deletions.
33 changes: 11 additions & 22 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,39 +25,28 @@ jobs:
HOMEBREW_GITHUB_PACKAGES_USER: ${{ github.actor }}
PULL_REQUEST: ${{ github.event.pull_request.number }}
steps:
- name: Checkout
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
GH_TOKEN: ${{ github.token }}
run: gh repo clone ${{ github.repository }} ${{ github.workspace }} -- --depth=1 --branch "$BRANCH"

- name: Configure git for a user
run: |-
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master

- name: Add brew to PATH
shell: bash
run: |-
{
echo "/home/linuxbrew/.linuxbrew/sbin";
echo "/home/linuxbrew/.linuxbrew/bin";
} >> "$GITHUB_PATH"
- name: Set up git
uses: Homebrew/actions/git-user-config@master

- name: Pull bottles
id: pr-pull
run: brew pr-pull --debug --retain-bottle-dir --no-upload --tap="$GITHUB_REPOSITORY" "$PULL_REQUEST"

- name: Upload bottles to GitHub Packages
working-directory: ${{ steps.pr-pull.outputs.bottle_path }}
env:
REPO_PATH: ${{ steps.set-up-homebrew.outputs.repository-path }}
run: brew pr-upload --debug

- name: Push commits
run: |-
credentials=$(echo -n "x-access-token:${{ github.token }}" | base64)
git config --local http.https://github.com/.extraheader "AUTHORIZATION: basic $credentials"
git pull --rebase --autostash origin main
git push
uses: Homebrew/actions/git-try-push@master
with:
token: ${{ github.token }}
branch: main

- name: Delete branch
if: github.event.pull_request.head.repo.fork == false
Expand Down
36 changes: 7 additions & 29 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,41 +15,19 @@ jobs:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
GH_TOKEN: ${{ github.token }}
run: gh repo clone ${{ github.repository }} ${{ github.workspace }} -- --depth=1 --branch "$BRANCH"
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master

- name: Configure git for a user
run: |-
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Add brew to PATH
shell: bash
run: |-
{
echo "/home/linuxbrew/.linuxbrew/sbin";
echo "/home/linuxbrew/.linuxbrew/bin";
} >> "$GITHUB_PATH"
- name: Setup Homebrew Bundler RubyGems cache
id: gems-cache
run: |-
GEMS_PATH="$(brew --repo)/Library/Homebrew/vendor/bundle/ruby/"
GEMS_HASH="$(shasum -a 256 "$(brew --repo)/Library/Homebrew/Gemfile.lock" | cut -f1 -d' ')"
{
echo "gems-path=$GEMS_PATH";
echo "gems-hash=$GEMS_HASH";
} >> "$GITHUB_OUTPUT"
- name: Set up git
uses: Homebrew/actions/git-user-config@master

- name: Cache Homebrew Bundler RubyGems
id: cache
uses: actions/cache@main
with:
path: ${{ steps.gems-cache.outputs.gems-path }}
key: ${{ runner.os }}-rubygems-${{ steps.gems-cache.outputs.gems-hash }}
path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
restore-keys: ${{ runner.os }}-rubygems-

- name: Install Homebrew Bundler RubyGems
Expand Down

0 comments on commit 0fccc52

Please sign in to comment.