name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build-rust:
name: Build Rust ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-14
target: aarch64-apple-darwin
- os: macos-15
target: x86_64-apple-darwin
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 with:
targets: ${{ matrix.target }}
- name: Add target to pinned toolchain
run: rustup target add ${{ matrix.target }}
- name: Build release binary
run: cargo build --release --locked --features cli --target ${{ matrix.target }}
- name: Rename artifacts
run: |
cd target/${{ matrix.target }}/release
cp axterminator axterminator-${{ matrix.target }}
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a with:
name: axterminator-${{ matrix.target }}
path: target/${{ matrix.target }}/release/axterminator-${{ matrix.target }}
release:
name: Create GitHub Release
needs: [build-rust]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Download all artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c with:
path: artifacts
- name: Prepare release files
run: |
mkdir -p release
find artifacts -type f -name "axterminator-*-apple-darwin" -exec cp {} release/ \;
cd release
ls -la
sha256sum -- * > checksums-sha256.txt || shasum -a 256 -- * > checksums-sha256.txt
cat checksums-sha256.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda with:
generate_release_notes: true
files: |
release/*
publish-crates-io:
name: Publish to crates.io
needs: [build-rust]
if: startsWith(github.ref, 'refs/tags/')
runs-on: macos-14
environment:
name: crates-io
url: https://crates.io/crates/axterminator
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8
- name: Publish to crates.io
run: cargo publish --features cli
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
update-homebrew:
name: Update Homebrew tap
needs: [release]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
environment:
name: homebrew
url: https://github.com/MikkoParkkola/homebrew-tap
permissions:
contents: write
steps:
- name: Checkout homebrew-tap
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with:
repository: MikkoParkkola/homebrew-tap
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
- name: Update formula
run: |
VERSION="${GITHUB_REF_NAME#v}"
URL="https://github.com/MikkoParkkola/axterminator/archive/refs/tags/${GITHUB_REF_NAME}.tar.gz"
SHA256=$(curl -sL "$URL" | sha256sum | cut -d' ' -f1)
cat > Formula/axterminator.rb << FORMULA
class Axterminator < Formula
desc "Background-first macOS GUI automation with MCP server support"
homepage "https://github.com/MikkoParkkola/axterminator"
url "$URL"
sha256 "$SHA256"
version "$VERSION"
license :cannot_represent
depends_on :macos
depends_on "rust" => :build
def install
system "cargo", "install",
"--locked",
"--features", "cli",
"--root", prefix,
"--path", "."
end
test do
assert_match "accessibility", shell_output("#{bin}/axterminator check")
end
end
FORMULA
- name: Commit and push
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/axterminator.rb
git commit -m "axterminator ${GITHUB_REF_NAME}" || echo "No changes"
git push