diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 64d37cf..5643d97 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -236,3 +236,86 @@ jobs: run: cargo publish -p anyllm_proxy --no-verify env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + + brew-release: + name: Homebrew tap release + needs: [test-deb] + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Download arm64 macOS binary + uses: actions/download-artifact@v4 + with: + name: anyllm_proxy-aarch64-apple-darwin + path: ./macos/arm64 + - name: Download x86_64 macOS binary + uses: actions/download-artifact@v4 + with: + name: anyllm_proxy-x86_64-apple-darwin + path: ./macos/x86_64 + - name: Create versioned tarballs + id: tarballs + run: | + VERSION="${{ github.ref_name }}" + VERSION="${VERSION#v}" + echo "version=${VERSION}" >> $GITHUB_OUTPUT + chmod +x ./macos/arm64/anyllm_proxy ./macos/x86_64/anyllm_proxy + mkdir -p dist + # rename binary to anyllm-proxy inside the archive (hyphen, not underscore) + cp ./macos/arm64/anyllm_proxy ./macos/arm64/anyllm-proxy + cp ./macos/x86_64/anyllm_proxy ./macos/x86_64/anyllm-proxy + tar -czf "dist/anyllm-proxy-${VERSION}-macos-arm64.tar.gz" -C ./macos/arm64 anyllm-proxy + tar -czf "dist/anyllm-proxy-${VERSION}-macos-x86_64.tar.gz" -C ./macos/x86_64 anyllm-proxy + - name: Upload macOS tarballs to GitHub Release + env: + GH_TOKEN: ${{ github.token }} + run: | + VERSION="${{ steps.tarballs.outputs.version }}" + gh release upload "${{ github.ref_name }}" \ + "dist/anyllm-proxy-${VERSION}-macos-arm64.tar.gz" \ + "dist/anyllm-proxy-${VERSION}-macos-x86_64.tar.gz" \ + --repo "${{ github.repository }}" --clobber + - name: Compute SHA256 + id: sha + run: | + VERSION="${{ steps.tarballs.outputs.version }}" + ARM64=$(sha256sum "dist/anyllm-proxy-${VERSION}-macos-arm64.tar.gz" | cut -d' ' -f1) + X86=$(sha256sum "dist/anyllm-proxy-${VERSION}-macos-x86_64.tar.gz" | cut -d' ' -f1) + echo "arm64=${ARM64}" >> $GITHUB_OUTPUT + echo "x86_64=${X86}" >> $GITHUB_OUTPUT + - name: Update Homebrew tap + if: ${{ secrets.HOMEBREW_TAP_TOKEN != '' }} + env: + HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} + run: | + VERSION="${{ steps.tarballs.outputs.version }}" + ARM64_SHA="${{ steps.sha.outputs.arm64 }}" + X86_SHA="${{ steps.sha.outputs.x86_64 }}" + + git clone "https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/whit3rabbit/homebrew-tap.git" + cd homebrew-tap + + cat > Casks/anyllm-proxy.rb << RUBY +cask "anyllm-proxy" do + arch arm: "arm64", intel: "x86_64" + + version "${VERSION}" + sha256 arm: "${ARM64_SHA}", + intel: "${X86_SHA}" + + url "https://github.com/whit3rabbit/anyllm-proxy/releases/download/v\#{version}/anyllm-proxy-\#{version}-macos-\#{arch}.tar.gz" + name "anyllm-proxy" + desc "HTTP proxy translating Anthropic Messages API and OpenAI Chat Completions to any backend" + homepage "https://github.com/whit3rabbit/anyllm-proxy" + + binary "anyllm-proxy" +end +RUBY + + git config user.email "github-actions[bot]@users.noreply.github.com" + git config user.name "github-actions[bot]" + git add Casks/anyllm-proxy.rb + git diff --staged --quiet || git commit -m "chore: update anyllm-proxy to ${VERSION}" + git push diff --git a/.gitignore b/.gitignore index d901930..fbadb75 100644 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,9 @@ Thumbs.db .cook/ .worktrees/ .playwright-mcp/ +.mcp.json +.repowise/ +.superpowers/ # Script caches and venv scripts/.cache/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..95de244 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +VERSION := $(shell grep '^version' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/') +ARCH := $(shell uname -m) + +.PHONY: help build release deb package clean + +help: + @printf "%-12s %s\n" build "debug build" + @printf "%-12s %s\n" release "release build (current platform)" + @printf "%-12s %s\n" deb "build .deb package (Linux only, requires cargo-deb)" + @printf "%-12s %s\n" package "create macOS tarball for Homebrew (macOS only)" + @printf "%-12s %s\n" clean "remove build and dist artifacts" + @printf "\nversion: $(VERSION)\n" + +build: + cargo build -p anyllm_proxy + +release: + cargo build --release -p anyllm_proxy + +deb: release + cargo deb -p anyllm_proxy --no-build --no-strip + +package: release + @mkdir -p dist + @cp target/release/anyllm_proxy dist/anyllm-proxy + @tar -czf dist/anyllm-proxy-$(VERSION)-macos-$(ARCH).tar.gz -C dist anyllm-proxy + @rm dist/anyllm-proxy + @echo "dist/anyllm-proxy-$(VERSION)-macos-$(ARCH).tar.gz" + +clean: + cargo clean + rm -rf dist/