brew tap #10
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: brew tap | |
on: | |
release: | |
types: [published] | |
jobs: | |
homebrew-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- name: Generate Homebrew Formula | |
id: generate_formula | |
run: | | |
VERSION=${{ github.event.release.tag_name }} | |
BASE_URL=https://github.com/yumafuu/ghq-fzf/releases/download/${VERSION}/ | |
SHA_LINUX_X64=$(curl -sL ${BASE_URL}/linux-x64 | shasum -a 256 | awk '{print $1}') | |
SHA_LINUX_ARM64=$(curl -sL ${BASE_URL}/linux-arm64 | shasum -a 256 | awk '{print $1}') | |
SHA_DARWIN_X64=$(curl -sL ${BASE_URL}/darwin-x64 | shasum -a 256 | awk '{print $1}') | |
SHA_DARWIN_ARM64=$(curl -sL ${BASE_URL}/darwin-arm64 | shasum -a 256 | awk '{print $1}') | |
cat <<EOF > ghq-fzf.rb | |
class GhqFzf < Formula | |
homepage "https://github.com/${{ github.repository }}" | |
version "$VERSION" | |
on_macos do | |
on_intel do | |
url "${BASE_URL}/darwin-x64" | |
sha256 "$SHA_DARWIN_X64" | |
def install | |
bin.install "_ghq-fzf" | |
end | |
end | |
on_arm do | |
url "${BASE_URL}/darwin-arm64" | |
sha256 "$SHA_DARWIN_ARM64" | |
def install | |
bin.install "_ghq-fzf" | |
end | |
end | |
end | |
on_linux do | |
on_intel do | |
if Hardware::CPU.is_64_bit? | |
url "${BASE_URL}/linux-x64" | |
sha256 "$SHA_LINUX_X64" | |
def install | |
bin.install "_ghq-fzf" | |
end | |
end | |
end | |
on_arm do | |
if Hardware::CPU.is_64_bit? | |
url "${BASE_URL}/linux-arm64" | |
sha256 "$SHA_LINUX_ARM64" | |
def install | |
bin.install "_ghq-fzf" | |
end | |
end | |
end | |
end | |
end | |
EOF | |
- name: Push Formula to Homebrew Tap | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB_TOKEN }} | |
run: | | |
TAP_REPO=yumafuu/homebrew-tap | |
git clone git@github.com:$TAP_REPO.git | |
mv ghq-fzf.rb homebrew-tap/ghq-fzf.rb | |
cd homebrew-tap | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -m "Update formula for version ${{ github.event.release.tag_name }}" | |
git push |