fix: update workflow to generate correct formula class name #20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish to Homebrew | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| release: | |
| types: [published] | |
| jobs: | |
| publish-homebrew: | |
| runs-on: ubuntu-latest | |
| if: | | |
| github.event_name != 'pull_request' | |
| steps: | |
| - name: Set version info | |
| run: | | |
| if [ "${{ github.event_name }}" = "release" ]; then | |
| VERSION="${{ github.event.release.tag_name }}" | |
| TARBALL_URL="https://github.com/zero8dotdev/warp-cli/archive/refs/tags/${VERSION}.tar.gz" | |
| else | |
| VERSION="main" | |
| TARBALL_URL="https://github.com/zero8dotdev/warp-cli/archive/refs/heads/main.tar.gz" | |
| fi | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "TARBALL_URL=$TARBALL_URL" >> $GITHUB_ENV | |
| - name: Checkout warp-cli | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: zero8dotdev/warp-cli | |
| ref: ${{ env.VERSION == 'main' && 'main' || github.event.release.tag_name }} | |
| - name: Download release tarball | |
| run: | | |
| curl -L "${{ env.TARBALL_URL }}" -o warp.tar.gz | |
| SHA256=$(shasum -a 256 warp.tar.gz | cut -d' ' -f1) | |
| echo "SHA256=$SHA256" >> $GITHUB_ENV | |
| - name: Checkout homebrew-tools | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: zero8dotdev/homebrew-tools | |
| token: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
| path: homebrew-tools | |
| - name: Update formula | |
| run: | | |
| cat > homebrew-tools/Formula/warp-cli.rb << 'EOF' | |
| class WarpCli < Formula | |
| desc "Beautiful CLI for Cloudflare WARP - Control your VPN from the terminal" | |
| homepage "https://github.com/zero8dotdev/warp-cli" | |
| url "${{ env.TARBALL_URL }}" | |
| sha256 "${{ env.SHA256 }}" | |
| version "0.1.0" | |
| license "MIT" | |
| head "https://github.com/zero8dotdev/warp-cli.git", branch: "main" | |
| depends_on "rust" => :build | |
| depends_on "cloudflare-warp" => :cask | |
| def install | |
| system "cargo", "build", "--release" | |
| bin.install "target/release/warp" | |
| end | |
| def post_install | |
| gui_app = "/Applications/Cloudflare WARP.app" | |
| if File.exist?(gui_app) | |
| puts "Removing Cloudflare WARP GUI app (daemon will continue running)..." | |
| system "rm", "-rf", gui_app | |
| end | |
| end | |
| def caveats | |
| <<~EOS | |
| ✅ WARP daemon installed and configured | |
| ✅ GUI app removed (not needed for CLI) | |
| Your WARP daemon is running. Try it: | |
| warp up # Connect to WARP | |
| warp status # Check connection | |
| warp --help # See all commands | |
| EOS | |
| end | |
| test do | |
| assert_match "warp", shell_output("#{bin}/warp --version") | |
| assert_match "Commands:", shell_output("#{bin}/warp --help") | |
| end | |
| end | |
| EOF | |
| - name: Commit and push | |
| working-directory: homebrew-tools | |
| run: | | |
| git config user.name "GitHub Actions" | |
| git config user.email "actions@github.com" | |
| git add Formula/warp-cli.rb | |
| git commit -m "chore: bump warp to ${{ env.VERSION }}" | |
| git push | |
| - name: Verify formula updated | |
| run: | | |
| if [ -f "homebrew-tools/Formula/warp-cli.rb" ]; then | |
| echo "✅ Formula successfully updated in homebrew-tools tap" | |
| grep -A2 "url " homebrew-tools/Formula/warp-cli.rb | head -3 | |
| else | |
| echo "❌ Formula file not found" | |
| exit 1 | |
| fi |