From 3996b127dfe9a66351e6d403daff034b45ded21a Mon Sep 17 00:00:00 2001 From: fireblocks_dx_team Date: Sun, 19 Apr 2026 12:35:25 +0000 Subject: [PATCH] Generated CLI #212 --- .github/workflows/draft-release-from-pr.yml | 4 +- .github/workflows/publish.yml | 76 ++++++++++++++++++++- 2 files changed, 77 insertions(+), 3 deletions(-) diff --git a/.github/workflows/draft-release-from-pr.yml b/.github/workflows/draft-release-from-pr.yml index 0c25e26..8e2356c 100644 --- a/.github/workflows/draft-release-from-pr.yml +++ b/.github/workflows/draft-release-from-pr.yml @@ -48,8 +48,8 @@ jobs: LAST_TAG=$(gh release list --limit 1 --json tagName -q '.[0].tagName') if [[ -z "$LAST_TAG" || "$LAST_TAG" == "null" ]]; then - echo "No existing release found. A release tag is required to calculate the next version." - exit 1 + echo "No existing releases found. Defaulting to v0.0.0 as the base version." + LAST_TAG="v0.0.0" fi echo "Found latest release: $LAST_TAG" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b40921b..7c8ecf7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -313,4 +313,78 @@ jobs: echo "Uploading $(basename "$file")..." gh release upload "$TAG" "$file" --repo "$GH_REPO" --clobber done - echo "All assets uploaded successfully!" \ No newline at end of file + echo "All assets uploaded successfully!" + + update-homebrew: + needs: upload-release-assets + runs-on: ubuntu-latest + steps: + - name: Generate GitHub App token + id: generate-token + uses: actions/create-github-app-token@v2 + with: + app-id: ${{ vars.CLI_GENERATION_APP_ID }} + private-key: ${{ secrets.CLI_GENERATION_APP_PRIVATE_KEY }} + owner: fireblocks + + - name: Download tarballs + uses: actions/download-artifact@v4 + with: + name: tarballs + path: dist/tarballs + + - name: Update Homebrew formula + env: + GH_TOKEN: ${{ steps.generate-token.outputs.token }} + run: | + TAG=${{ github.event.release.tag_name }} + VERSION="${TAG#v}" + + ARM64_FILE=$(ls dist/tarballs/*darwin-arm64*.tar.gz | head -1) + X64_FILE=$(ls dist/tarballs/*darwin-x64*.tar.gz | head -1) + + ARM64_SHA256=$(sha256sum "$ARM64_FILE" | awk '{print $1}') + X64_SHA256=$(sha256sum "$X64_FILE" | awk '{print $1}') + + BASE_URL="https://github.com/fireblocks/fireblocks-cli/releases/download/${TAG}" + ARM64_FILENAME=$(basename "$ARM64_FILE") + X64_FILENAME=$(basename "$X64_FILE") + + git clone "https://x-access-token:${GH_TOKEN}@github.com/fireblocks/homebrew-fireblocks-cli.git" tap + cd tap + + git config user.email "github-actions@github.com" + git config user.name "GitHub Actions" + + mkdir -p Formula + cat > Formula/fireblocks-cli.rb << FORMULA + class FireblocksCli < Formula + desc "Agent-first CLI for Fireblocks infrastructure" + homepage "https://github.com/fireblocks/fireblocks-cli" + version "${VERSION}" + license "MIT" + + on_macos do + if Hardware::CPU.arm? + url "${BASE_URL}/${ARM64_FILENAME}" + sha256 "${ARM64_SHA256}" + else + url "${BASE_URL}/${X64_FILENAME}" + sha256 "${X64_SHA256}" + end + end + + def install + libexec.install Dir["*"] + bin.write_exec_script libexec/"bin/fireblocks" + end + + test do + assert_match version.to_s, shell_output("#{bin}/fireblocks --version") + end + end + FORMULA + + git add Formula/fireblocks-cli.rb + git commit -m "Update fireblocks-cli to ${VERSION}" + git push \ No newline at end of file