Skip to content

Commit 436c741

Browse files
Alezander9bcode
andauthored
C1 + C4: cross-platform release workflow + bcode.sh install script (#13)
* C1 + C4: cross-platform release workflow + bcode.sh install script Three pieces, intended to land together so a tag push produces a complete matrix of release assets and the install one-liner becomes self-serve: 1. .github/workflows/release.yml — on `v*` tag push (or workflow_dispatch), runs build.ts on a Linux runner, Bun cross-compiles every target (linux x64/arm64 [+baseline +musl], darwin x64/arm64 [+baseline], windows x64/arm64 [+baseline]), and uploads archives to the matching GitHub Release. Creates the release as prerelease if it doesn't exist yet so reruns work via --clobber. 2. packages/opencode/script/build.ts — split the dist subdir name (npm package id, `@browser-use/browsercode-core-<target>`) from the release-asset basename (`bcode-<target>`). Archives now write to `dist/bcode-<target>.{tar.gz,zip}` and the upload glob is `./dist/bcode-*`. Required so the install script can construct stable, slash-free asset URLs. Yellow-zone — documented in memory/browsercode/EXCEPTIONS.md. 3. install.sh — port of opencode's installer. Diffs vs upstream: APP=bcode, INSTALL_DIR=$HOME/.bcode/bin, repo URL is browser-use/browsercode, shell-rc marker is `# bcode`, BrowserCode wordmark + footer text. Adds a uv-on-PATH check that prints a one-line install hint when missing (the harness needs uv at runtime for browser_execute) — never auto-installs. Verified locally: build.ts `--single` for linux-x64 still produces the correct binary; archive cwd math (`../../../` from `dist/<scope>/<pkg>-<target>/bin/`) lands archives at `dist/bcode-<target>.tar.gz`. Typecheck passes. install.sh syntax-clean under `bash -n`. Pre-conditions for the install one-liner to work end-to-end (post-merge): - Repo made public (or install script switches to a private-fetch path). - DNS for bcode.sh CNAME'd to a static host serving install.sh. - A v0.0.3 tag pushed to trigger the new workflow. * Add release workflow for cross-platform CLI builds * Use TUI wordmark banner (browsercode) in install.sh --------- Co-authored-by: bcode <bcode@agents.local>
1 parent 247b4c3 commit 436c741

3 files changed

Lines changed: 588 additions & 9 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: release
2+
3+
# Build the bcode CLI for every platform we ship and attach the archives to
4+
# the GitHub Release matching the pushed tag.
5+
#
6+
# Trigger:
7+
# - Push a tag matching `v*` (e.g. `v0.0.3`).
8+
#
9+
# Behaviour:
10+
# 1. Reuses the existing `packages/opencode/script/build.ts` matrix
11+
# (linux x64/arm64, darwin x64/arm64, win32 x64/arm64; baseline + musl
12+
# variants where applicable).
13+
# 2. Bun cross-compiles every target from a single Linux runner.
14+
# 3. With `OPENCODE_RELEASE=1`, `build.ts` archives each target as
15+
# `dist/bcode-<os>-<arch>...{.tar.gz,.zip}` and uploads via `gh release
16+
# upload --clobber`.
17+
#
18+
# Pre-condition: the tag must already have an existing GitHub Release
19+
# (created either manually with `gh release create vX.Y.Z` or by an upcoming
20+
# release-creation workflow). `--clobber` lets re-runs replace assets.
21+
22+
on:
23+
push:
24+
tags:
25+
- "v*"
26+
workflow_dispatch:
27+
inputs:
28+
tag:
29+
description: "Release tag to build (must already exist as a Release)"
30+
required: true
31+
type: string
32+
33+
permissions:
34+
contents: write
35+
36+
concurrency:
37+
group: release-${{ github.ref }}
38+
cancel-in-progress: false
39+
40+
jobs:
41+
build:
42+
runs-on: ubuntu-24.04
43+
if: github.repository == 'browser-use/browsercode'
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v4
47+
with:
48+
fetch-depth: 0
49+
50+
- name: Resolve tag + version
51+
id: ver
52+
run: |
53+
if [ -n "${{ inputs.tag }}" ]; then
54+
TAG="${{ inputs.tag }}"
55+
else
56+
TAG="${GITHUB_REF#refs/tags/}"
57+
fi
58+
VERSION="${TAG#v}"
59+
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
60+
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
61+
echo "Building tag=${TAG} version=${VERSION}"
62+
63+
- name: Setup Bun
64+
uses: ./.github/actions/setup-bun
65+
66+
- name: Ensure GitHub Release exists
67+
env:
68+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
run: |
70+
# `build.ts` uploads via `gh release upload --clobber`, which requires
71+
# the release to already exist. Create as a prerelease if missing; the
72+
# admin can promote/edit notes after assets land.
73+
if ! gh release view "${{ steps.ver.outputs.tag }}" >/dev/null 2>&1; then
74+
echo "Creating prerelease ${{ steps.ver.outputs.tag }}"
75+
gh release create "${{ steps.ver.outputs.tag }}" \
76+
--prerelease \
77+
--title "${{ steps.ver.outputs.tag }}" \
78+
--notes "Automated build for ${{ steps.ver.outputs.tag }}. Notes pending."
79+
else
80+
echo "Release ${{ steps.ver.outputs.tag }} already exists."
81+
fi
82+
83+
- name: Build all targets and upload to release
84+
env:
85+
OPENCODE_VERSION: ${{ steps.ver.outputs.version }}
86+
OPENCODE_RELEASE: "1"
87+
OPENCODE_CHANNEL: latest
88+
GH_REPO: ${{ github.repository }}
89+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
run: |
91+
./packages/opencode/script/build.ts
92+
93+
- name: Summarise uploaded assets
94+
env:
95+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
96+
run: |
97+
echo "## Release ${{ steps.ver.outputs.tag }}" >> "$GITHUB_STEP_SUMMARY"
98+
echo "" >> "$GITHUB_STEP_SUMMARY"
99+
gh release view "${{ steps.ver.outputs.tag }}" --json assets \
100+
--jq '.assets[] | "- " + .name + " (" + (.size|tostring) + " bytes)"' \
101+
>> "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)