@@ -0,0 +1,23 @@
|
|||||||
|
# Changesets
|
||||||
|
|
||||||
|
This project uses [Changesets](https://github.com/changesets/changesets) for versioning and changelog generation.
|
||||||
|
|
||||||
|
## Adding a changeset
|
||||||
|
|
||||||
|
When you make a change that should be released, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pnpm changeset
|
||||||
|
```
|
||||||
|
|
||||||
|
This will prompt you to:
|
||||||
|
1. Select the type of change (patch, minor, major)
|
||||||
|
2. Write a summary of your changes
|
||||||
|
|
||||||
|
The changeset file will be committed with your PR.
|
||||||
|
|
||||||
|
## Release process
|
||||||
|
|
||||||
|
When changesets are merged to `main`, the release workflow will:
|
||||||
|
1. Create a "Version Packages" PR that updates version numbers and changelogs
|
||||||
|
2. When that PR is merged, packages are automatically published to npm
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
|
||||||
|
"changelog": "@changesets/cli/changelog",
|
||||||
|
"commit": false,
|
||||||
|
"fixed": [],
|
||||||
|
"linked": [],
|
||||||
|
"access": "public",
|
||||||
|
"baseBranch": "main",
|
||||||
|
"updateInternalDependencies": "patch",
|
||||||
|
"ignore": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,225 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: Release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
published: ${{ steps.changesets.outputs.published }}
|
||||||
|
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 9
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '22'
|
||||||
|
cache: pnpm
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Create Release Pull Request or Publish to npm
|
||||||
|
id: changesets
|
||||||
|
uses: changesets/action@v1
|
||||||
|
with:
|
||||||
|
version: pnpm ci:version
|
||||||
|
publish: pnpm ci:publish
|
||||||
|
title: 'chore: version packages'
|
||||||
|
commit: 'chore: version packages'
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_VERCEL_TOKEN_ELEVATED }}
|
||||||
|
|
||||||
|
# Build native binaries for all platforms (only after changesets publishes)
|
||||||
|
build-binaries:
|
||||||
|
name: Build ${{ matrix.name }}
|
||||||
|
needs: release
|
||||||
|
if: needs.release.outputs.published == 'true'
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- name: Linux x64
|
||||||
|
os: ubuntu-latest
|
||||||
|
target: x86_64-unknown-linux-gnu
|
||||||
|
binary: agent-browser-linux-x64
|
||||||
|
use_zigbuild: true
|
||||||
|
- name: Linux ARM64
|
||||||
|
os: ubuntu-latest
|
||||||
|
target: aarch64-unknown-linux-gnu
|
||||||
|
binary: agent-browser-linux-arm64
|
||||||
|
use_zigbuild: true
|
||||||
|
- name: Windows x64
|
||||||
|
os: ubuntu-latest
|
||||||
|
target: x86_64-pc-windows-gnu
|
||||||
|
binary: agent-browser-win32-x64.exe
|
||||||
|
use_zigbuild: false
|
||||||
|
- name: macOS x64
|
||||||
|
os: macos-latest
|
||||||
|
target: x86_64-apple-darwin
|
||||||
|
binary: agent-browser-darwin-x64
|
||||||
|
use_zigbuild: false
|
||||||
|
- name: macOS ARM64
|
||||||
|
os: macos-latest
|
||||||
|
target: aarch64-apple-darwin
|
||||||
|
binary: agent-browser-darwin-arm64
|
||||||
|
use_zigbuild: false
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: main
|
||||||
|
|
||||||
|
- name: Setup pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 9
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '22'
|
||||||
|
cache: pnpm
|
||||||
|
|
||||||
|
- name: Install npm dependencies
|
||||||
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Sync version
|
||||||
|
run: pnpm run version:sync
|
||||||
|
|
||||||
|
- name: Setup Rust toolchain
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
targets: ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Install cross-compilation tools (Linux)
|
||||||
|
if: runner.os == 'Linux'
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y gcc-aarch64-linux-gnu gcc-x86-64-linux-gnu mingw-w64
|
||||||
|
|
||||||
|
- name: Install cargo-zigbuild
|
||||||
|
if: matrix.use_zigbuild
|
||||||
|
run: |
|
||||||
|
pip3 install ziglang
|
||||||
|
cargo install cargo-zigbuild
|
||||||
|
|
||||||
|
- name: Configure Rust linkers
|
||||||
|
if: runner.os == 'Linux'
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.cargo
|
||||||
|
cat >> ~/.cargo/config.toml << 'EOF'
|
||||||
|
[target.aarch64-unknown-linux-gnu]
|
||||||
|
linker = "aarch64-linux-gnu-gcc"
|
||||||
|
|
||||||
|
[target.x86_64-pc-windows-gnu]
|
||||||
|
linker = "x86_64-w64-mingw32-gcc"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
- name: Cache Cargo dependencies
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/bin/
|
||||||
|
~/.cargo/registry/index/
|
||||||
|
~/.cargo/registry/cache/
|
||||||
|
~/.cargo/git/db/
|
||||||
|
cli/target/
|
||||||
|
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('cli/Cargo.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-cargo-${{ matrix.target }}-
|
||||||
|
|
||||||
|
- name: Build with zigbuild
|
||||||
|
if: matrix.use_zigbuild
|
||||||
|
run: cargo zigbuild --release --manifest-path cli/Cargo.toml --target ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Build with cargo
|
||||||
|
if: '!matrix.use_zigbuild'
|
||||||
|
run: cargo build --release --manifest-path cli/Cargo.toml --target ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Copy binary
|
||||||
|
run: |
|
||||||
|
mkdir -p artifacts
|
||||||
|
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
|
||||||
|
cp cli/target/${{ matrix.target }}/release/agent-browser.exe artifacts/${{ matrix.binary }}
|
||||||
|
else
|
||||||
|
cp cli/target/${{ matrix.target }}/release/agent-browser artifacts/${{ matrix.binary }}
|
||||||
|
chmod +x artifacts/${{ matrix.binary }}
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: ${{ matrix.binary }}
|
||||||
|
path: artifacts/${{ matrix.binary }}
|
||||||
|
retention-days: 7
|
||||||
|
|
||||||
|
# Create GitHub release with binaries after npm publish
|
||||||
|
github-release:
|
||||||
|
name: Create GitHub Release
|
||||||
|
needs: [release, build-binaries]
|
||||||
|
if: needs.release.outputs.published == 'true'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: main
|
||||||
|
|
||||||
|
- name: Download all artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: bin/
|
||||||
|
|
||||||
|
- name: Move binaries to bin directory
|
||||||
|
run: |
|
||||||
|
for dir in bin/*/; do
|
||||||
|
mv "$dir"* bin/
|
||||||
|
rmdir "$dir"
|
||||||
|
done
|
||||||
|
chmod +x bin/agent-browser-* 2>/dev/null || true
|
||||||
|
ls -la bin/
|
||||||
|
|
||||||
|
- name: Verify binaries exist
|
||||||
|
run: |
|
||||||
|
BINARY_COUNT=$(ls bin/agent-browser-* 2>/dev/null | wc -l)
|
||||||
|
if [ "$BINARY_COUNT" -lt 5 ]; then
|
||||||
|
echo "Error: Expected 5 binaries, found $BINARY_COUNT"
|
||||||
|
ls -la bin/
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Found $BINARY_COUNT binaries"
|
||||||
|
|
||||||
|
- name: Create GitHub Release
|
||||||
|
run: |
|
||||||
|
VERSION=$(node -p "require('./package.json').version")
|
||||||
|
gh release create "v$VERSION" \
|
||||||
|
--title "v$VERSION" \
|
||||||
|
--generate-notes \
|
||||||
|
bin/agent-browser-*
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
+5
-1
@@ -32,7 +32,10 @@
|
|||||||
"format:check": "prettier --check 'src/**/*.ts'",
|
"format:check": "prettier --check 'src/**/*.ts'",
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
"test:watch": "vitest",
|
"test:watch": "vitest",
|
||||||
"postinstall": "node scripts/postinstall.js"
|
"postinstall": "node scripts/postinstall.js",
|
||||||
|
"changeset": "changeset",
|
||||||
|
"ci:version": "changeset version && pnpm install --no-frozen-lockfile",
|
||||||
|
"ci:publish": "pnpm run version:sync && pnpm run build && changeset publish"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"browser",
|
"browser",
|
||||||
@@ -57,6 +60,7 @@
|
|||||||
"zod": "^3.22.4"
|
"zod": "^3.22.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@changesets/cli": "^2.29.8",
|
||||||
"@types/node": "^20.10.0",
|
"@types/node": "^20.10.0",
|
||||||
"@types/ws": "^8.18.1",
|
"@types/ws": "^8.18.1",
|
||||||
"husky": "^9.1.7",
|
"husky": "^9.1.7",
|
||||||
|
|||||||
Generated
+700
File diff suppressed because it is too large
Load Diff
@@ -30,7 +30,7 @@ const packageJson = JSON.parse(
|
|||||||
const version = packageJson.version;
|
const version = packageJson.version;
|
||||||
|
|
||||||
// GitHub release URL
|
// GitHub release URL
|
||||||
const GITHUB_REPO = 'anthropics/agent-browser'; // Update this to your actual repo
|
const GITHUB_REPO = 'vercel-labs/agent-browser';
|
||||||
const DOWNLOAD_URL = `https://github.com/${GITHUB_REPO}/releases/download/v${version}/${binaryName}`;
|
const DOWNLOAD_URL = `https://github.com/${GITHUB_REPO}/releases/download/v${version}/${binaryName}`;
|
||||||
|
|
||||||
async function downloadFile(url, dest) {
|
async function downloadFile(url, dest) {
|
||||||
|
|||||||
Reference in New Issue
Block a user