Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/draft-release-from-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
76 changes: 75 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -313,4 +313,78 @@ jobs:
echo "Uploading $(basename "$file")..."
gh release upload "$TAG" "$file" --repo "$GH_REPO" --clobber
done
echo "All assets uploaded successfully!"
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
Loading