Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build bottles with Actions workflow #13

Merged
merged 3 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 129 additions & 0 deletions .github/workflows/build-bottle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: Build Homebrew bottle

on:
workflow_dispatch:
push:
branches: [build-bottle]

env:
HOMEBREW_DEVELOPER: 1
HOMEBREW_GITHUB_ACTIONS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_FROM_API: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
BOTTLE_ROOT_URL: https://ghcr.io/v2/rbenv/tap

defaults:
run:
shell: bash -xeuo pipefail {0}

# concurrency: bottle-${{ github.event.inputs.formula }}

permissions:
contents: read

jobs:
build:
strategy:
matrix:
formula: [[email protected], [email protected]]
os: [macos-13, macos-14, macos-15]

runs-on: ${{ matrix.os }}

steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
core: false
cask: false
test-bot: false

- name: Cache Homebrew Bundler RubyGems
id: cache
uses: actions/cache@v3
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-

- name: Install Homebrew Bundler RubyGems
if: steps.cache.outputs.cache-hit != 'true'
run: brew install-bundler-gems

- name: Uninstall existing formula
run: brew uninstall --force --ignore-dependencies --formula "$FORMULA_NAME"
env:
FORMULA_NAME: ${{ matrix.formula }}

- name: Install formula
run: brew install --build-bottle "$FORMULA_NAME"
env:
FORMULA_NAME: rbenv/tap/${{ matrix.formula }}
HOMEBREW_NO_ENV_HINTS: 1

- name: Build bottle
run: brew bottle --json "$FORMULA_NAME" --root-url "$BOTTLE_ROOT_URL" --keep-old
env:
FORMULA_NAME: rbenv/tap/${{ matrix.formula }}

- run: ls -l

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: bottle_${{ matrix.formula }}_${{ matrix.os }}
if-no-files-found: error
path: |
*.bottle.*.tar.gz
*.bottle.json

upload:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
core: false
cask: false
test-bot: false

- name: Cache Homebrew Bundler RubyGems
id: cache
uses: actions/cache@v3
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-

- name: Install Homebrew Bundler RubyGems
if: steps.cache.outputs.cache-hit != 'true'
run: brew install-bundler-gems

- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true

- name: Upload bottles
run: brew pr-upload --root-url "$BOTTLE_ROOT_URL" --warn-on-upload-failure
env:
HOMEBREW_GIT_NAME: Mislav Marohnić
HOMEBREW_GIT_EMAIL: [email protected]
HOMEBREW_GITHUB_PACKAGES_USER: mislav
HOMEBREW_GITHUB_PACKAGES_TOKEN: ${{ secrets.BOTTLE_UPLOAD_TOKEN }}

- name: Push formula changes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git switch -c bottles-"$(date "+%s")"
git push -u origin HEAD
gh pr create --title "Update bottles" --head "$(git branch --show-current)"
4 changes: 3 additions & 1 deletion Formula/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ class OpensslAT10 < Formula
bottle do
root_url "https://ghcr.io/v2/rbenv/tap"
rebuild 1
sha256 arm64_sequoia: "61cdee4c9e1ab293123e3a885d08279491eeedd73f8b614c531982f42d93e196"
sha256 arm64_sequoia: "2930154a14b21831c65b6a3aeed388708168d01dbb6923f36a9112b29cf3f835"
sha256 arm64_sonoma: "9689f2e649b1714a9af04eec431ffe544e1b256f005c0ced700c3fd8f8a3c65e"
sha256 ventura: "0e913dad6155463b53e026a7a8202bc13e7c89aab71e7093f50c14de05aee692"
end

keg_only :provided_by_macos,
Expand Down
4 changes: 3 additions & 1 deletion Formula/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ class OpensslAT11 < Formula
bottle do
root_url "https://ghcr.io/v2/rbenv/tap"
rebuild 1
sha256 arm64_sequoia: "72c82547363b360620ffdb34857f1682100885c2b2431d455fa1d1edebe124d5"
sha256 arm64_sequoia: "b50fa064fcbaaba0e409516ff0856baa5ecede547870a4fbffd0a892a25da177"
sha256 arm64_sonoma: "df6e2e88146e496ad304a04730dd23b89e9e2ed197804452cebd52d83f2cac84"
sha256 ventura: "eb5c26b540c5a5543edd3557d1628ce03f03e6c5ac1b219be9b34e436b10ba64"
end

keg_only :versioned_formula
Expand Down
Loading