v0.0.1 #20
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 | |
permissions: | |
contents: write | |
on: | |
release: | |
types: [published] | |
jobs: | |
homebrew-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout homebrew-tap repo | |
uses: actions/checkout@v4 | |
with: | |
repository: "yumafuu/homebrew-tap" | |
fetch-depth: 0 | |
path: homebrew-tap | |
token: ${{ secrets.TAP_GITHUB_TOKEN }} | |
- name: Generate Homebrew 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 "darwin-x64" => "_ghq-fzf" | |
end | |
end | |
on_arm do | |
url "${BASE_URL}/darwin-arm64" | |
sha256 "$SHA_DARWIN_ARM64" | |
def install | |
bin.install "darwin-arm64" => "_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 "linux-x64" => "_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 "linux-arm64" => "_ghq-fzf" | |
end | |
end | |
end | |
end | |
end | |
EOF | |
- name: Push Formula to Homebrew Tap | |
env: | |
GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }} | |
run: | | |
TAP_REPO=yumafuu/homebrew-tap | |
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 origin main |