Skip to content

Commit 016024c

Browse files
committed
feat: add release pipeline for crates.io and npm publishing
- Add --check, --publish-crates, --publish-npm-sdk, --publish-npm-cli flags to release script - Create CI workflow with pre-release checks (cargo fmt, clippy, test, tsc) - Update release workflow to run checks, build binaries, and publish packages - Add @sandbox-agent/cli npm package with platform-specific binaries (esbuild pattern) - Configure TypeScript SDK for npm publishing (exports, files, types) - Add crates.io metadata to Cargo.toml (repository, description) - Rename @sandbox-agent/web to @sandbox-agent/inspector
1 parent 6e1b13c commit 016024c

26 files changed

Lines changed: 360 additions & 48 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_call:
8+
9+
jobs:
10+
checks:
11+
runs-on: ubuntu-24.04
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: dtolnay/rust-toolchain@stable
15+
with:
16+
components: rustfmt, clippy
17+
- uses: Swatinem/rust-cache@v2
18+
- uses: pnpm/action-setup@v4
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: 20
22+
cache: pnpm
23+
- run: pnpm install
24+
- name: Run checks
25+
run: ./scripts/release/main.ts --version 0.0.0 --check

.github/workflows/release.yaml

Lines changed: 65 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ env:
1818
CARGO_INCREMENTAL: 0
1919

2020
jobs:
21+
checks:
22+
uses: ./.github/workflows/ci.yaml
23+
2124
setup:
2225
name: "Setup"
26+
needs: [checks]
2327
runs-on: ubuntu-24.04
2428
outputs:
2529
version: ${{ steps.vars.outputs.version }}
@@ -54,7 +58,7 @@ jobs:
5458
./scripts/release/main.ts --version "${{ steps.vars.outputs.version }}" --print-latest --output "$GITHUB_OUTPUT"
5559
5660
binaries:
57-
name: "Build & Upload Binaries"
61+
name: "Build Binaries"
5862
needs: [setup]
5963
strategy:
6064
matrix:
@@ -89,42 +93,58 @@ jobs:
8993
docker/release/build.sh ${{ matrix.target }}
9094
ls -la dist/
9195
92-
- name: Install AWS CLI
93-
run: |
94-
sudo apt-get update
95-
sudo apt-get install -y unzip curl
96+
- name: Upload artifact
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: binary-${{ matrix.target }}
100+
path: dist/sandbox-agent-${{ matrix.target }}${{ matrix.binary_ext }}
96101

97-
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
98-
unzip awscliv2.zip
99-
sudo ./aws/install --update
102+
publish:
103+
name: "Publish Packages"
104+
needs: [setup, binaries]
105+
runs-on: ubuntu-24.04
106+
steps:
107+
- uses: actions/checkout@v4
108+
with:
109+
fetch-depth: 0
110+
111+
- uses: dtolnay/rust-toolchain@stable
112+
113+
- uses: pnpm/action-setup@v4
114+
115+
- uses: actions/setup-node@v4
116+
with:
117+
node-version: 20
118+
registry-url: 'https://registry.npmjs.org'
119+
cache: pnpm
120+
121+
- name: Install tsx
122+
run: npm install -g tsx
123+
124+
- name: Download binaries
125+
uses: actions/download-artifact@v4
126+
with:
127+
path: dist/
128+
pattern: binary-*
129+
merge-multiple: true
130+
131+
- name: List downloaded binaries
132+
run: ls -la dist/
100133

101-
- name: Upload binaries
134+
- name: Publish all
102135
env:
103-
AWS_ACCESS_KEY_ID: ${{ secrets.R2_RELEASES_ACCESS_KEY_ID }}
104-
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_RELEASES_SECRET_ACCESS_KEY }}
136+
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
137+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
105138
run: |
106139
VERSION="${{ needs.setup.outputs.version }}"
107-
BINARY_NAME="sandbox-agent-${{ matrix.target }}${{ matrix.binary_ext }}"
108-
109-
aws s3 cp \
110-
"dist/${BINARY_NAME}" \
111-
"s3://rivet-releases/sandbox-agent/${VERSION}/${BINARY_NAME}" \
112-
--region auto \
113-
--endpoint-url https://2a94c6a0ced8d35ea63cddc86c2681e7.r2.cloudflarestorage.com \
114-
--checksum-algorithm CRC32
115-
116-
if [ "${{ needs.setup.outputs.latest }}" = "true" ]; then
117-
aws s3 cp \
118-
"dist/${BINARY_NAME}" \
119-
"s3://rivet-releases/sandbox-agent/latest/${BINARY_NAME}" \
120-
--region auto \
121-
--endpoint-url https://2a94c6a0ced8d35ea63cddc86c2681e7.r2.cloudflarestorage.com \
122-
--checksum-algorithm CRC32
123-
fi
140+
./scripts/release/main.ts --version "$VERSION" \
141+
--publish-crates \
142+
--publish-npm-sdk \
143+
--publish-npm-cli
124144
125145
artifacts:
126-
name: "TypeScript + Install Script"
127-
needs: [setup]
146+
name: "Upload Artifacts"
147+
needs: [setup, binaries]
128148
runs-on: ubuntu-24.04
129149
steps:
130150
- uses: actions/checkout@v4
@@ -147,7 +167,17 @@ jobs:
147167
unzip awscliv2.zip
148168
sudo ./aws/install --update
149169
150-
- name: Upload TypeScript artifacts and install script
170+
- name: Download binaries
171+
uses: actions/download-artifact@v4
172+
with:
173+
path: dist/
174+
pattern: binary-*
175+
merge-multiple: true
176+
177+
- name: List downloaded binaries
178+
run: ls -la dist/
179+
180+
- name: Upload artifacts
151181
env:
152182
R2_RELEASES_ACCESS_KEY_ID: ${{ secrets.R2_RELEASES_ACCESS_KEY_ID }}
153183
R2_RELEASES_SECRET_ACCESS_KEY: ${{ secrets.R2_RELEASES_SECRET_ACCESS_KEY }}
@@ -159,4 +189,7 @@ jobs:
159189
LATEST_FLAG="--no-latest"
160190
fi
161191
162-
./scripts/release/main.ts --version "$VERSION" $LATEST_FLAG --upload-typescript --upload-install
192+
./scripts/release/main.ts --version "$VERSION" $LATEST_FLAG \
193+
--upload-typescript \
194+
--upload-install \
195+
--upload-binaries

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Universal schema guidance:
4141

4242
### Default port references (update when CLI default changes)
4343

44-
- `frontend/packages/web/src/App.tsx`
44+
- `frontend/packages/inspector/src/App.tsx`
4545
- `README.md`
4646
- `docs/cli.mdx`
4747
- `docs/frontend.mdx`

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ eval "$(sandbox-agent credentials extract-env --export)"
2525
Run the web console (includes all dependencies):
2626

2727
```bash
28-
pnpm dev -F @sandbox-agent/web
28+
pnpm dev -F @sandbox-agent/inspector
2929
```
3030

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ version = "0.1.0"
77
edition = "2021"
88
authors = ["Sandbox Agent Contributors"]
99
license = "Apache-2.0"
10+
repository = "https://github.com/rivet-dev/sandbox-agent"
11+
description = "Universal agent API for AI coding assistants"

docs/frontend.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ title: "Frontend Demo"
33
description: "Run the Vite + React UI for testing the daemon."
44
---
55

6-
The demo frontend lives at `frontend/packages/web`.
6+
The demo frontend lives at `frontend/packages/inspector`.
77

88
## Run locally
99

1010
```bash
1111
pnpm install
12-
pnpm --filter @sandbox-agent/web dev
12+
pnpm --filter @sandbox-agent/inspector dev
1313
```
1414

1515
The UI expects:
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@ RUN npm install -g pnpm
44

55
# Copy package files for all workspaces
66
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
7-
COPY frontend/packages/web/package.json ./frontend/packages/web/
7+
COPY frontend/packages/inspector/package.json ./frontend/packages/inspector/
88
COPY sdks/typescript/package.json ./sdks/typescript/
99

1010
# Install dependencies
11-
RUN pnpm install --filter @sandbox-agent/web...
11+
RUN pnpm install --filter @sandbox-agent/inspector...
1212

1313
# Copy SDK source (with pre-generated types)
1414
COPY sdks/typescript ./sdks/typescript
1515

1616
# Build SDK (just tsc, skip generate since types are pre-generated)
1717
RUN cd sdks/typescript && pnpm exec tsc -p tsconfig.json
1818

19-
# Copy web source
20-
COPY frontend/packages/web ./frontend/packages/web
19+
# Copy inspector source
20+
COPY frontend/packages/inspector ./frontend/packages/inspector
2121

22-
# Build web
23-
RUN cd frontend/packages/web && pnpm exec vite build
22+
# Build inspector
23+
RUN cd frontend/packages/inspector && pnpm exec vite build
2424

2525
FROM caddy:alpine
26-
COPY --from=build /app/frontend/packages/web/dist /srv
26+
COPY --from=build /app/frontend/packages/inspector/dist /srv
2727
RUN cat > /etc/caddy/Caddyfile <<'EOF'
2828
:80 {
2929
root * /srv
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@sandbox-agent/web",
2+
"name": "@sandbox-agent/inspector",
33
"private": true,
44
"version": "0.0.0",
55
"license": "Apache-2.0",

0 commit comments

Comments
 (0)