Skip to content

Commit 1fb000a

Browse files
author
Derek
committed
feat: add Homebrew tap publishing to release workflow
Publish formula to hyperi-io/homebrew-macbash tap on release using a GitHub App token for secure cross-repo access. Also fix org name in formula template from hypersec-io to hyperi-io.
1 parent 82e508d commit 1fb000a

2 files changed

Lines changed: 37 additions & 5 deletions

File tree

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,35 @@ jobs:
162162
env:
163163
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
164164
run: semantic-release
165+
166+
- name: Generate GitHub App token for tap repo
167+
if: steps.version.outputs.release_needed == 'true'
168+
id: app-token
169+
uses: actions/create-github-app-token@v1
170+
with:
171+
app-id: ${{ secrets.HOMEBREW_APP_ID }}
172+
private-key: ${{ secrets.HOMEBREW_APP_PRIVATE_KEY }}
173+
owner: hyperi-io
174+
repositories: homebrew-macbash
175+
176+
- name: Publish Homebrew formula to tap
177+
if: steps.version.outputs.release_needed == 'true'
178+
env:
179+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
180+
run: |
181+
VERSION=${{ steps.version.outputs.version }}
182+
183+
# Clone the tap repo using the app token
184+
git clone "https://x-access-token:${GH_TOKEN}@github.com/hyperi-io/homebrew-macbash.git" /tmp/homebrew-macbash
185+
186+
# Copy the generated formula
187+
mkdir -p /tmp/homebrew-macbash/Formula
188+
cp dist/macbash.rb /tmp/homebrew-macbash/Formula/macbash.rb
189+
190+
# Commit and push
191+
cd /tmp/homebrew-macbash
192+
git config user.name "github-actions[bot]"
193+
git config user.email "github-actions[bot]@users.noreply.github.com"
194+
git add Formula/macbash.rb
195+
git commit -m "Update macbash to ${VERSION}"
196+
git push

packaging/homebrew/macbash.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@
88

99
class Macbash < Formula
1010
desc "Bash script compatibility checker for macOS"
11-
homepage "https://github.com/hypersec-io/macbash"
11+
homepage "https://github.com/hyperi-io/macbash"
1212
version "${VERSION}"
1313
license "Apache-2.0"
1414

1515
on_macos do
1616
if Hardware::CPU.arm?
17-
url "https://github.com/hypersec-io/macbash/releases/download/v${VERSION}/macbash-darwin-arm64.tar.gz"
17+
url "https://github.com/hyperi-io/macbash/releases/download/v${VERSION}/macbash-darwin-arm64.tar.gz"
1818
sha256 "${SHA256_DARWIN_ARM64}"
1919
else
20-
url "https://github.com/hypersec-io/macbash/releases/download/v${VERSION}/macbash-darwin-amd64.tar.gz"
20+
url "https://github.com/hyperi-io/macbash/releases/download/v${VERSION}/macbash-darwin-amd64.tar.gz"
2121
sha256 "${SHA256_DARWIN_AMD64}"
2222
end
2323
end
2424

2525
on_linux do
2626
if Hardware::CPU.arm?
27-
url "https://github.com/hypersec-io/macbash/releases/download/v${VERSION}/macbash-linux-arm64.tar.gz"
27+
url "https://github.com/hyperi-io/macbash/releases/download/v${VERSION}/macbash-linux-arm64.tar.gz"
2828
sha256 "${SHA256_LINUX_ARM64}"
2929
else
30-
url "https://github.com/hypersec-io/macbash/releases/download/v${VERSION}/macbash-linux-amd64.tar.gz"
30+
url "https://github.com/hyperi-io/macbash/releases/download/v${VERSION}/macbash-linux-amd64.tar.gz"
3131
sha256 "${SHA256_LINUX_AMD64}"
3232
end
3333
end

0 commit comments

Comments
 (0)