Repository navigation
Distribute the FinalRun CLI as a Bun-compiled binary via curl|sh #111
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ca351a0
Add finalrun cloud commands (test/suite/upload) with app validation
droid-ash ae211a2
Merge branch 'main' of https://github.com/final-run/finalrun-agent in…
droid-ash 1523bcb
Merge remote-tracking branch 'origin/main' into claude/epic-archimede…
droid-ash 146ddb4
Phase 1: Extract @finalrun/cloud-core
droid-ash 6d9d527
Phase 2: Lazy-loading scaffolding for local-runtime modules
droid-ash 3c47721
Phase 3: Add @finalrun/local-runtime package + per-platform tarball b…
droid-ash dc63992
Phase 4: Bun compile + rewrite scripts/install.sh for binary distribu…
droid-ash 483a7b0
Phase 5: Stop publishing to npm
droid-ash 1d3ca36
Phase 6: Add finalrun upgrade subcommand
droid-ash 96b4695
Honor FINALRUN_DIR in the binary's runtime resolver
droid-ash 71858b1
Bake CLI version into the Bun-compiled binary
droid-ash d4b06f8
Add manual-trigger GitHub Actions release workflow
droid-ash fc009fa
Address CodeRabbit review on PR #111 (16 actionable findings)
droid-ash c77192e
Address remaining active CodeRabbit findings on PR #111
droid-ash 8c50afd
Address 4 follow-up CodeRabbit findings on PR #111
droid-ash File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| ## Install | ||
|
|
||
| One command on macOS or Linux. No Node.js, no npm, nothing else required. | ||
|
|
||
| ```sh | ||
| curl -fsSL https://raw.githubusercontent.com/final-run/finalrun-agent/main/scripts/install.sh | bash | ||
| ``` | ||
|
|
||
| For CI / non-interactive environments: | ||
|
|
||
| ```sh | ||
| curl -fsSL https://raw.githubusercontent.com/final-run/finalrun-agent/main/scripts/install.sh | bash -s -- --cloud-only | ||
| ``` | ||
|
|
||
| To force the full local-dev setup (when TTY detection misfires): | ||
|
|
||
| ```sh | ||
| curl -fsSL https://raw.githubusercontent.com/final-run/finalrun-agent/main/scripts/install.sh | bash -s -- --full-setup | ||
| ``` | ||
|
|
||
| ## Artifacts | ||
|
|
||
| | Platform | Binary | Runtime tarball | | ||
| |---|---|---| | ||
| | macOS Apple Silicon | `finalrun-darwin-arm64` | `finalrun-runtime-<version>-darwin-arm64.tar.gz` | | ||
| | macOS Intel | `finalrun-darwin-x64` | `finalrun-runtime-<version>-darwin-x64.tar.gz` | | ||
| | Linux x86_64 | `finalrun-linux-x64` | `finalrun-runtime-<version>-linux-x64.tar.gz` | | ||
| | Linux ARM64 | `finalrun-linux-arm64` | `finalrun-runtime-<version>-linux-arm64.tar.gz` | | ||
|
|
||
| Each artifact ships with a matching `.sha256` sidecar. | ||
|
|
||
| ## Upgrading from a previous version | ||
|
|
||
| ```sh | ||
| finalrun upgrade | ||
| ``` | ||
|
|
||
| The CLI re-runs the install script with sensible defaults (auto-detects whether you previously installed the runtime tarball, preserves your install directory). |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,177 @@ | ||
| name: Release | ||
|
|
||
| # Manual-only trigger. Click "Run workflow" in the Actions tab. | ||
| # | ||
| # Flow when triggered from main (or any branch): | ||
| # 1. Reads version from packages/cli/package.json on the chosen branch. | ||
| # 2. Fails fast if the matching tag (v<version>) already exists. | ||
| # 3. Builds all 4 Bun binaries (darwin-arm64/x64, linux-x64/arm64). | ||
| # 4. Builds all 4 runtime tarballs (per-platform). | ||
| # 5. Tags the exact build SHA as v<version> and pushes the tag. | ||
| # 6. Creates a GitHub Release at that tag, attaches all artifacts + | ||
| # their .sha256 sidecars, marks it as "latest". | ||
| # | ||
| # To cut a release: | ||
| # 1. Bump packages/cli/package.json version on a branch (default main). | ||
| # 2. Commit + push to the branch. | ||
| # 3. Actions tab → Release → Run workflow → choose branch → Run. | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| branch: | ||
| description: 'Branch to release from' | ||
| required: false | ||
| default: 'main' | ||
|
|
||
| permissions: | ||
| contents: write # create tag + GitHub Release | ||
|
|
||
| # Serialize releases so two clicks of "Run workflow" can't race on tag | ||
| # creation, both build the full artifact set, and then duel on `git push`. | ||
| # cancel-in-progress: false → queue rather than abort the in-flight run. | ||
| concurrency: | ||
| group: release-${{ github.event.inputs.branch }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-24.04 | ||
| outputs: | ||
| version: ${{ steps.version.outputs.version }} | ||
| tag: ${{ steps.version.outputs.tag }} | ||
| sha: ${{ steps.version.outputs.sha }} | ||
| is_latest: ${{ steps.version.outputs.is_latest }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.event.inputs.branch }} | ||
| fetch-depth: 0 # need history + tags so we can validate uniqueness | ||
|
|
||
| - name: Resolve & validate version | ||
| id: version | ||
| run: | | ||
| set -euo pipefail | ||
| VERSION=$(node -p "require('./packages/cli/package.json').version") | ||
| TAG="v${VERSION}" | ||
| SHA=$(git rev-parse HEAD) | ||
| BRANCH="${{ github.event.inputs.branch }}" | ||
|
|
||
| # Strict semver: 0.1.7, 1.2.3, 0.2.0-rc.1, 0.2.0-beta.1, etc. | ||
| # Rejects empty, non-numeric, or trailing-junk versions. | ||
| if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then | ||
| echo "::error::Invalid semver in packages/cli/package.json: '$VERSION'" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Refuse if the tag already exists locally OR on origin (the local | ||
| # check alone misses tags pushed by other contributors / CI runs). | ||
| if git rev-parse --verify --quiet "refs/tags/$TAG" >/dev/null; then | ||
| echo "::error::Tag $TAG already exists locally. Bump packages/cli/package.json or delete the existing tag." | ||
| exit 1 | ||
| fi | ||
| if git ls-remote --tags --exit-code origin "refs/tags/$TAG" >/dev/null 2>&1; then | ||
| echo "::error::Tag $TAG already exists on origin. Bump packages/cli/package.json." | ||
| exit 1 | ||
| fi | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| # Pre-release tags (e.g. 0.2.0-rc.1) should NOT clobber the | ||
| # "latest" pointer; only stable releases from main do that. | ||
| IS_LATEST="false" | ||
| if [[ "$BRANCH" == "main" && ! "$VERSION" =~ - ]]; then | ||
| IS_LATEST="true" | ||
| fi | ||
|
|
||
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | ||
| echo "sha=$SHA" >> "$GITHUB_OUTPUT" | ||
| echo "is_latest=$IS_LATEST" >> "$GITHUB_OUTPUT" | ||
| echo "Releasing $TAG from $BRANCH commit $SHA (is-latest: $IS_LATEST)" | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20.19' | ||
| cache: 'npm' | ||
| - run: npm ci | ||
|
|
||
| - uses: oven-sh/setup-bun@v2 | ||
| with: | ||
| bun-version: '1.3.11' | ||
|
|
||
| - name: Build all workspace dist files | ||
| run: | | ||
| npm run build --workspace=@finalrun/common | ||
| npm run build --workspace=@finalrun/cloud-core | ||
| npm run build --workspace=@finalrun/device-node | ||
| npm run build --workspace=@finalrun/goal-executor | ||
| npm run build --workspace=@finalrun/report-web | ||
| npm run build --workspace=@finalrun/finalrun-agent | ||
|
|
||
| - name: Build binaries (all 4 targets via Bun cross-compile) | ||
| run: ./scripts/build-binary.sh | ||
|
|
||
| - name: Build runtime tarballs (all 4 targets) | ||
| run: | | ||
| for t in darwin-arm64 darwin-x64 linux-x64 linux-arm64; do | ||
| npm run build:tarball --workspace=@finalrun/local-runtime -- --target="$t" | ||
| done | ||
|
|
||
| - name: Stage release artifacts | ||
| run: | | ||
| mkdir -p release-artifacts | ||
| cp dist/binaries/finalrun-* release-artifacts/ | ||
| cp packages/local-runtime/dist/finalrun-runtime-*.tar.gz* release-artifacts/ | ||
| ls -la release-artifacts/ | ||
|
|
||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: release-artifacts | ||
| path: release-artifacts/ | ||
| retention-days: 7 | ||
|
|
||
| release: | ||
| needs: build | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ needs.build.outputs.sha }} | ||
| fetch-depth: 0 | ||
|
|
||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| name: release-artifacts | ||
| path: release-artifacts/ | ||
|
|
||
| - name: Tag the build commit and push the tag | ||
| env: | ||
| TAG: ${{ needs.build.outputs.tag }} | ||
| SHA: ${{ needs.build.outputs.sha }} | ||
| run: | | ||
| set -euo pipefail | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
| git tag -a "$TAG" "$SHA" -m "Release $TAG" | ||
| git push origin "$TAG" | ||
|
|
||
| - name: Create GitHub Release with all artifacts | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| TAG: ${{ needs.build.outputs.tag }} | ||
| VERSION: ${{ needs.build.outputs.version }} | ||
| IS_LATEST: ${{ needs.build.outputs.is_latest }} | ||
| run: | | ||
| set -euo pipefail | ||
| # Pre-releases (e.g. 0.2.0-rc.1) and releases from non-main | ||
| # branches don't update the "latest" pointer that install.sh and | ||
| # the README badges resolve against. | ||
| extra_flags=() | ||
| if [ "$IS_LATEST" = "true" ]; then | ||
| extra_flags+=(--latest) | ||
| else | ||
| extra_flags+=(--prerelease) | ||
| fi | ||
| gh release create "$TAG" \ | ||
| --title "FinalRun $VERSION" \ | ||
| --notes-file .github/release-notes-template.md \ | ||
| "${extra_flags[@]}" \ | ||
| release-artifacts/* | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,3 +61,4 @@ pnpm-debug.log* | |
| /.codex | ||
|
|
||
| /.gemini | ||
| dist/ | ||
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.