name: Release
on:
push:
tags: ['v*']
permissions:
contents: write
env:
BIN_NAME: agent-offload
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: macos-15
target: aarch64-apple-darwin
artifact: agent-offload-darwin-arm64
use_cross: false
- os: macos-15
target: x86_64-apple-darwin
artifact: agent-offload-darwin-amd64
use_cross: false
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
artifact: agent-offload-linux-amd64
use_cross: true
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
artifact: agent-offload-linux-arm64
use_cross: true
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross
if: matrix.use_cross
uses: taiki-e/install-action@cross
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build
run: |
if [ "${{ matrix.use_cross }}" == "true" ]; then
cross build --release --locked --target ${{ matrix.target }}
else
cargo build --release --locked --target ${{ matrix.target }}
fi
- name: Package
run: |
bin="target/${{ matrix.target }}/release/${BIN_NAME}"
tar -C "$(dirname "$bin")" -czf ${{ matrix.artifact }}.tar.gz ${BIN_NAME}
shasum -a 256 ${{ matrix.artifact }}.tar.gz > ${{ matrix.artifact }}.sha256
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: |
${{ matrix.artifact }}.tar.gz
${{ matrix.artifact }}.sha256
release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.RELEASE_TOKEN }}
generate_release_notes: true
files: |
*.tar.gz
*.sha256
update-tap:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Clone tap repository
env:
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: |
git clone "https://x-access-token:${RELEASE_TOKEN}@github.com/raine/homebrew-agent-offload.git" tap
cd tap
git switch main || git switch -c main
- name: Generate formula and push to tap
env:
VERSION: ${{ github.ref_name }}
run: |
VERSION="${VERSION#v}"
SHA_MAC_ARM=$(awk '{print $1}' agent-offload-darwin-arm64.sha256)
SHA_MAC_INTEL=$(awk '{print $1}' agent-offload-darwin-amd64.sha256)
SHA_LINUX_INTEL=$(awk '{print $1}' agent-offload-linux-amd64.sha256)
SHA_LINUX_ARM=$(awk '{print $1}' agent-offload-linux-arm64.sha256)
mkdir -p tap/Formula
cat > tap/Formula/agent-offload.rb << EOF
class AgentOffload < Formula
desc "Launch coding agents in tmux panes and wait for completion"
homepage "https://github.com/raine/agent-offload"
version "${VERSION}"
license "MIT"
on_macos do
if Hardware::CPU.arm?
url "https://github.com/raine/agent-offload/releases/download/v${VERSION}/agent-offload-darwin-arm64.tar.gz"
sha256 "${SHA_MAC_ARM}"
else
url "https://github.com/raine/agent-offload/releases/download/v${VERSION}/agent-offload-darwin-amd64.tar.gz"
sha256 "${SHA_MAC_INTEL}"
end
end
on_linux do
if Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
url "https://github.com/raine/agent-offload/releases/download/v${VERSION}/agent-offload-linux-arm64.tar.gz"
sha256 "${SHA_LINUX_ARM}"
else
url "https://github.com/raine/agent-offload/releases/download/v${VERSION}/agent-offload-linux-amd64.tar.gz"
sha256 "${SHA_LINUX_INTEL}"
end
end
def install
bin.install "agent-offload"
end
test do
assert_match version.to_s, shell_output("#{bin}/agent-offload --version")
end
end
EOF
sed -i 's/^ //' tap/Formula/agent-offload.rb
cd tap
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/agent-offload.rb
git commit -m "agent-offload ${VERSION}"
if git ls-remote --exit-code --heads origin main; then
git pull --rebase origin main
fi
git push origin main