name: Release
on:
push:
tags:
- "v*"
- "[0-9]+.*"
workflow_dispatch:
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-apple-darwin
os: macos-15
- target: aarch64-apple-darwin
os: macos-15
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross-compilation tools (ARM Linux)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Set linker for ARM Linux
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
mkdir -p .cargo
echo '[target.aarch64-unknown-linux-gnu]' >> .cargo/config.toml
echo 'linker = "aarch64-linux-gnu-gcc"' >> .cargo/config.toml
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Package
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../rip-${{ matrix.target }}.tar.gz rip
cd ../../..
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: rip-${{ matrix.target }}
path: rip-${{ matrix.target }}.tar.gz
release:
name: Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: List artifacts
run: ls -la artifacts/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
generate_release_notes: true
- name: Compute checksums
run: |
cd artifacts
echo "MAC_ARM_SHA=$(sha256sum rip-aarch64-apple-darwin.tar.gz | cut -d' ' -f1)" >> $GITHUB_ENV
echo "MAC_INTEL_SHA=$(sha256sum rip-x86_64-apple-darwin.tar.gz | cut -d' ' -f1)" >> $GITHUB_ENV
echo "LINUX_ARM_SHA=$(sha256sum rip-aarch64-unknown-linux-gnu.tar.gz | cut -d' ' -f1)" >> $GITHUB_ENV
echo "LINUX_INTEL_SHA=$(sha256sum rip-x86_64-unknown-linux-gnu.tar.gz | cut -d' ' -f1)" >> $GITHUB_ENV
- name: Checkout Homebrew tap
uses: actions/checkout@v4
with:
repository: cesarferreira/homebrew-tap
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
path: tap
- name: Update formula
run: |
TAG=${GITHUB_REF_NAME}
VERSION=${TAG#v}
FORMULA=tap/Formula/rip.rb
cat > $FORMULA << EOF
class Rip < Formula
desc "Fuzzy find and kill processes from your terminal"
homepage "https://github.com/cesarferreira/rip"
version "${VERSION}"
license "MIT"
on_macos do
on_arm do
url "https://github.com/cesarferreira/rip/releases/download/${TAG}/rip-aarch64-apple-darwin.tar.gz"
sha256 "${MAC_ARM_SHA}"
end
on_intel do
url "https://github.com/cesarferreira/rip/releases/download/${TAG}/rip-x86_64-apple-darwin.tar.gz"
sha256 "${MAC_INTEL_SHA}"
end
end
on_linux do
on_arm do
url "https://github.com/cesarferreira/rip/releases/download/${TAG}/rip-aarch64-unknown-linux-gnu.tar.gz"
sha256 "${LINUX_ARM_SHA}"
end
on_intel do
url "https://github.com/cesarferreira/rip/releases/download/${TAG}/rip-x86_64-unknown-linux-gnu.tar.gz"
sha256 "${LINUX_INTEL_SHA}"
end
end
def install
bin.install "rip"
end
test do
system "#{bin}/rip", "--help"
end
end
EOF
- name: Commit and push tap
run: |
cd tap
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/rip.rb
git commit -m "rip ${VERSION}"
git push
env:
VERSION: ${{ github.ref_name }}