omnigraph/scripts/update-homebrew-formula.sh
Andrew Altshuler 372f793ad6
Drop macOS x86_64 build target (#55)
Stop producing the omnigraph-macos-x86_64 archive in both the
stable and edge release workflows. The macos-15-intel runner
build was the slowest of the matrix and Apple Silicon is now
the default Mac developer target.

- release.yml + release-edge.yml: drop the macos-15-intel matrix entry
- install.sh: drop the Darwin/x86_64 case so Intel Macs get a clear
  "no prebuilt binary" error instead of attempting an absent download
- update-homebrew-formula.sh: drop the MACOS_X86_* variables and emit
  an arm64-only Homebrew formula. The on_macos block now declares
  `depends_on arch: :arm64` so Intel `brew install` fails fast with
  a clear architecture message instead of installing an arm64 binary
  that errors at exec time.

Linux x86_64 build is unaffected.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 18:19:26 +03:00

97 lines
2.2 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
usage() {
cat <<'EOF'
Usage: update-homebrew-formula.sh <tag> [formula_path]
Environment:
REPO_SLUG GitHub repo that owns the Omnigraph release
default: ModernRelay/omnigraph
EOF
}
need_cmd() {
command -v "$1" >/dev/null 2>&1 || {
printf 'error: missing required command: %s\n' "$1" >&2
exit 1
}
}
asset_digest() {
local release_json="$1"
local asset_name="$2"
jq -r --arg name "$asset_name" '
.assets[]
| select(.name == $name)
| (.digest // "")
| sub("^sha256:"; "")
' <<<"$release_json"
}
TAG="${1:-}"
FORMULA_PATH="${2:-Formula/omnigraph.rb}"
REPO_SLUG="${REPO_SLUG:-ModernRelay/omnigraph}"
if [[ -z "$TAG" ]]; then
usage
exit 1
fi
need_cmd gh
need_cmd jq
VERSION="${TAG#v}"
RELEASE_JSON="$(gh release view "$TAG" --repo "$REPO_SLUG" --json assets)"
MACOS_ARM_URL="https://github.com/${REPO_SLUG}/releases/download/${TAG}/omnigraph-macos-arm64.tar.gz"
LINUX_X86_URL="https://github.com/${REPO_SLUG}/releases/download/${TAG}/omnigraph-linux-x86_64.tar.gz"
MACOS_ARM_SHA="$(asset_digest "$RELEASE_JSON" "omnigraph-macos-arm64.tar.gz")"
LINUX_X86_SHA="$(asset_digest "$RELEASE_JSON" "omnigraph-linux-x86_64.tar.gz")"
for value in "$MACOS_ARM_SHA" "$LINUX_X86_SHA"; do
if [[ -z "$value" ]]; then
printf 'error: failed to resolve one or more release asset digests for %s\n' "$TAG" >&2
exit 1
fi
done
mkdir -p "$(dirname "$FORMULA_PATH")"
cat >"$FORMULA_PATH" <<EOF
class Omnigraph < Formula
desc "Typed property graph database with Git-style workflows"
homepage "https://github.com/${REPO_SLUG}"
license "MIT"
version "${VERSION}"
on_macos do
depends_on arch: :arm64
url "${MACOS_ARM_URL}"
sha256 "${MACOS_ARM_SHA}"
end
on_linux do
url "${LINUX_X86_URL}"
sha256 "${LINUX_X86_SHA}"
end
head "https://github.com/${REPO_SLUG}.git", branch: "main"
livecheck do
url :stable
regex(/^v?(\\d+(?:\\.\\d+)+)$/i)
end
def install
bin.install "omnigraph", "omnigraph-server"
end
test do
assert_match "omnigraph ", shell_output("#{bin}/omnigraph version")
assert_match "HTTP server for the Omnigraph graph database", shell_output("#{bin}/omnigraph-server --help")
end
end
EOF