mirror of
https://github.com/browseros-ai/BrowserOS.git
synced 2026-05-13 15:46:22 +00:00
* feat(cli): skip self-update prompts for package manager installs Checks BROWSEROS_INSTALL_METHOD env var (npm, brew) and skips automatic update checks. Users should use their package manager's update mechanism. FormatNotice now shows the appropriate upgrade command based on install method. * feat(cli): add npm bin wrapper for browseros-cli * feat(cli): add npm postinstall script to download platform binary Downloads the correct platform binary from GitHub releases during npm install, verifies SHA256 checksums, and extracts to .binary directory. * feat(cli): add npm package metadata and README Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: move npm package files to correct monorepo path The bin wrapper and postinstall were created at apps/cli/npm/ instead of packages/browseros-agent/apps/cli/npm/. Moves them to the correct location. * style: use node: protocol for builtin module imports * feat(cli): add Makefile npm targets and release workflow npm publish step Adds npm-version and npm-publish Makefile targets for version sync. Adds Node.js setup and npm publish step to the release workflow. Adds npm/npx install instructions to release notes template. * fix(cli): fail on missing checksum entry and limit redirect depth - Abort if checksums.txt downloaded but archive entry is missing - Warn if checksums.txt itself failed to download - Cap redirect depth at 5 to prevent stack overflow on circular redirects * fix(cli): match install.sh checksum behavior — warn instead of abort The existing shell installer (install.sh) warns and continues when the checksum entry is missing from checksums.txt. Match that behavior in the npm postinstall to avoid unnecessary install failures. Both files come from the same GitHub release, so the checksum is a corruption check, not a strong security boundary. --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
162 lines
4.8 KiB
YAML
162 lines
4.8 KiB
YAML
name: Release BrowserOS CLI
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: "Release version (e.g. 0.1.0)"
|
|
required: true
|
|
type: string
|
|
|
|
concurrency:
|
|
group: release-cli
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
release:
|
|
if: github.ref == 'refs/heads/main'
|
|
runs-on: ubuntu-latest
|
|
environment: release-core
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
defaults:
|
|
run:
|
|
working-directory: packages/browseros-agent/apps/cli
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: packages/browseros-agent/apps/cli/go.mod
|
|
|
|
- uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: "1.3.6"
|
|
|
|
- name: Run tests
|
|
run: make test
|
|
|
|
- name: Run vet
|
|
run: make vet
|
|
|
|
- name: Build all platforms
|
|
run: make release VERSION=${{ inputs.version }} POSTHOG_API_KEY=${{ secrets.POSTHOG_API_KEY }}
|
|
|
|
- name: Install dependencies
|
|
run: bun install
|
|
working-directory: packages/browseros-agent
|
|
|
|
- name: Upload to CDN
|
|
env:
|
|
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
|
|
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
|
|
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
|
R2_BUCKET: ${{ secrets.R2_BUCKET }}
|
|
R2_UPLOAD_PREFIX: cli
|
|
CLI_VERSION: ${{ inputs.version }}
|
|
run: |
|
|
bun scripts/build/cli.ts \
|
|
--release \
|
|
--version "$CLI_VERSION" \
|
|
--binaries-dir apps/cli/dist
|
|
working-directory: packages/browseros-agent
|
|
|
|
- name: Generate release notes
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
CLI_PATH="packages/browseros-agent/apps/cli"
|
|
TAG="browseros-cli-v${{ inputs.version }}"
|
|
CHANGELOG_FILE="/tmp/release-changelog.md"
|
|
PREV_TAG=$(git tag -l "browseros-cli-v*" --sort=-v:refname | grep -v "^${TAG}$" | head -n 1)
|
|
|
|
if [ -z "$PREV_TAG" ]; then
|
|
echo "Initial release of browseros-cli." > "$CHANGELOG_FILE"
|
|
else
|
|
COMMITS=$(git log "$PREV_TAG"..HEAD --pretty=format:"%H" -- "$CLI_PATH")
|
|
|
|
if [ -z "$COMMITS" ]; then
|
|
echo "No notable changes." > "$CHANGELOG_FILE"
|
|
else
|
|
echo "## What's Changed" > "$CHANGELOG_FILE"
|
|
echo "" >> "$CHANGELOG_FILE"
|
|
|
|
while IFS= read -r SHA; do
|
|
SUBJECT=$(git log -1 --pretty=format:"%s" "$SHA")
|
|
PR_NUM=$(gh api "/repos/${{ github.repository }}/commits/${SHA}/pulls" --jq '.[0].number // empty' 2>/dev/null)
|
|
|
|
if [ -n "$PR_NUM" ] && ! echo "$SUBJECT" | grep -qF "(#${PR_NUM})"; then
|
|
echo "- ${SUBJECT} (#${PR_NUM})" >> "$CHANGELOG_FILE"
|
|
else
|
|
echo "- ${SUBJECT}" >> "$CHANGELOG_FILE"
|
|
fi
|
|
done <<< "$COMMITS"
|
|
fi
|
|
fi
|
|
|
|
cat "$CHANGELOG_FILE" > /tmp/release-notes.md
|
|
cat >> /tmp/release-notes.md <<'EOF'
|
|
|
|
## Install `browseros-cli`
|
|
|
|
### npm / npx
|
|
|
|
```bash
|
|
npx browseros-cli --help
|
|
npm install -g browseros-cli
|
|
```
|
|
|
|
### macOS / Linux
|
|
|
|
```bash
|
|
curl -fsSL https://cdn.browseros.com/cli/install.sh | bash
|
|
```
|
|
|
|
### Windows
|
|
|
|
```powershell
|
|
irm https://cdn.browseros.com/cli/install.ps1 | iex
|
|
```
|
|
|
|
After install, run `browseros-cli init` to point the CLI at your BrowserOS MCP server.
|
|
EOF
|
|
working-directory: ${{ github.workspace }}
|
|
|
|
- name: Create tag and release
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
TAG="browseros-cli-v${{ inputs.version }}"
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
if ! git rev-parse "$TAG" >/dev/null 2>&1; then
|
|
git tag -a "$TAG" -m "browseros-cli v${{ inputs.version }}"
|
|
git push origin "$TAG"
|
|
fi
|
|
|
|
CLI_DIST="packages/browseros-agent/apps/cli/dist"
|
|
gh release create "$TAG" \
|
|
--title "BrowserOS CLI - v${{ inputs.version }}" \
|
|
--notes-file /tmp/release-notes.md \
|
|
${CLI_DIST}/*
|
|
working-directory: ${{ github.workspace }}
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
registry-url: "https://registry.npmjs.org"
|
|
|
|
- name: Publish to npm
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
run: |
|
|
make npm-version VERSION=${{ inputs.version }}
|
|
cd npm
|
|
npm publish --access public
|