Skip to content

Feat(cli): Add Bun-based binary release workflow #713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ben-fornefeld
Copy link
Member

@ben-fornefeld ben-fornefeld commented May 3, 2025

This PR introduces a new workflow for building and releasing standalone CLI binaries using Bun.

Key changes:

  • bun build --compile for creating binaries (faster builds, potentially smaller size).
  • Added a build script packages/cli/scripts/build-binaries.sh to:
    • Compile binaries for Linux (x64), macOS (x64, arm64), and Windows (x64).
    • Embed the version in the output filename (cli_VERSION_os_arch).
    • Generate a corresponding cli_VERSION_checksums.txt file.
  • Added a testing script packages/cli/scripts/test-binary.sh to:
    • Detect the native OS (Linux/Darwin) and architecture (x64/arm64) where the script is run.
    • Locate the corresponding built binary.
    • Perform a smoke test by running the binary with --version.
    • Verify the exit code and check if the output contains the correct version.
  • Created a new workflow .github/workflows/cli_release_binaries.yml:
    • Triggers when tags matching @e2b/cli@<version> are pushed.
    • Installs dependencies using pnpm install --frozen-lockfile.
    • Runs the build-binaries.sh script via pnpm run.
    • Runs the test-binary.sh script via pnpm run to test the binary built for the runner's native architecture.
    • Uploads the generated binaries and checksum file to the corresponding GitHub Release.
    • Includes logic to optionally upload binaries to the latest existing CLI release if triggered manually (requires gh CLI).
  • Updated package.json scripts.
  • Set execute permission for build-binaries.sh & test-binary.sh.

Build Script Output
Screenshot 2025-05-03 at 3 59 41 PM

CLI Release Content
Screenshot 2025-05-04 at 1 45 37 PM

…triggering on cli release tags, building & uploading releases
@ben-fornefeld ben-fornefeld added the cli Improvements or additions to CLI label May 3, 2025
@ben-fornefeld ben-fornefeld self-assigned this May 3, 2025
Copy link

changeset-bot bot commented May 3, 2025

⚠️ No Changeset found

Latest commit: 5a3c1db

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ben-fornefeld ben-fornefeld marked this pull request as draft May 4, 2025 12:07
@ben-fornefeld ben-fornefeld added the stale Not being worked on at the moment, but worth keeping around label May 5, 2025
@ben-fornefeld
Copy link
Member Author

marked as "stale" for now because we should look for a binary compilation that packages the nodejs runtime, not the bun runtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Improvements or additions to CLI stale Not being worked on at the moment, but worth keeping around
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant