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
This commit is contained in:
Nathan Flurry 2026-01-25 14:11:39 -08:00
parent 6e1b13c242
commit 016024c04b
26 changed files with 360 additions and 48 deletions

25
.github/workflows/ci.yaml vendored Normal file
View file

@ -0,0 +1,25 @@
name: ci
on:
push:
branches: [main]
pull_request:
workflow_call:
jobs:
checks:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- run: pnpm install
- name: Run checks
run: ./scripts/release/main.ts --version 0.0.0 --check

View file

@ -18,8 +18,12 @@ env:
CARGO_INCREMENTAL: 0
jobs:
checks:
uses: ./.github/workflows/ci.yaml
setup:
name: "Setup"
needs: [checks]
runs-on: ubuntu-24.04
outputs:
version: ${{ steps.vars.outputs.version }}
@ -54,7 +58,7 @@ jobs:
./scripts/release/main.ts --version "${{ steps.vars.outputs.version }}" --print-latest --output "$GITHUB_OUTPUT"
binaries:
name: "Build & Upload Binaries"
name: "Build Binaries"
needs: [setup]
strategy:
matrix:
@ -89,42 +93,58 @@ jobs:
docker/release/build.sh ${{ matrix.target }}
ls -la dist/
- name: Install AWS CLI
run: |
sudo apt-get update
sudo apt-get install -y unzip curl
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.target }}
path: dist/sandbox-agent-${{ matrix.target }}${{ matrix.binary_ext }}
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install --update
publish:
name: "Publish Packages"
needs: [setup, binaries]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Upload binaries
- uses: dtolnay/rust-toolchain@stable
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
cache: pnpm
- name: Install tsx
run: npm install -g tsx
- name: Download binaries
uses: actions/download-artifact@v4
with:
path: dist/
pattern: binary-*
merge-multiple: true
- name: List downloaded binaries
run: ls -la dist/
- name: Publish all
env:
AWS_ACCESS_KEY_ID: ${{ secrets.R2_RELEASES_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_RELEASES_SECRET_ACCESS_KEY }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
VERSION="${{ needs.setup.outputs.version }}"
BINARY_NAME="sandbox-agent-${{ matrix.target }}${{ matrix.binary_ext }}"
aws s3 cp \
"dist/${BINARY_NAME}" \
"s3://rivet-releases/sandbox-agent/${VERSION}/${BINARY_NAME}" \
--region auto \
--endpoint-url https://2a94c6a0ced8d35ea63cddc86c2681e7.r2.cloudflarestorage.com \
--checksum-algorithm CRC32
if [ "${{ needs.setup.outputs.latest }}" = "true" ]; then
aws s3 cp \
"dist/${BINARY_NAME}" \
"s3://rivet-releases/sandbox-agent/latest/${BINARY_NAME}" \
--region auto \
--endpoint-url https://2a94c6a0ced8d35ea63cddc86c2681e7.r2.cloudflarestorage.com \
--checksum-algorithm CRC32
fi
./scripts/release/main.ts --version "$VERSION" \
--publish-crates \
--publish-npm-sdk \
--publish-npm-cli
artifacts:
name: "TypeScript + Install Script"
needs: [setup]
name: "Upload Artifacts"
needs: [setup, binaries]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
@ -147,7 +167,17 @@ jobs:
unzip awscliv2.zip
sudo ./aws/install --update
- name: Upload TypeScript artifacts and install script
- name: Download binaries
uses: actions/download-artifact@v4
with:
path: dist/
pattern: binary-*
merge-multiple: true
- name: List downloaded binaries
run: ls -la dist/
- name: Upload artifacts
env:
R2_RELEASES_ACCESS_KEY_ID: ${{ secrets.R2_RELEASES_ACCESS_KEY_ID }}
R2_RELEASES_SECRET_ACCESS_KEY: ${{ secrets.R2_RELEASES_SECRET_ACCESS_KEY }}
@ -159,4 +189,7 @@ jobs:
LATEST_FLAG="--no-latest"
fi
./scripts/release/main.ts --version "$VERSION" $LATEST_FLAG --upload-typescript --upload-install
./scripts/release/main.ts --version "$VERSION" $LATEST_FLAG \
--upload-typescript \
--upload-install \
--upload-binaries