mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 08:03:46 +00:00
- 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
195 lines
4.8 KiB
YAML
195 lines
4.8 KiB
YAML
name: release
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: "Version (e.g. 0.1.0 or v0.1.0)"
|
|
required: true
|
|
type: string
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash -e {0}
|
|
|
|
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 }}
|
|
latest: ${{ steps.latest.outputs.latest }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Install tsx
|
|
run: npm install -g tsx
|
|
|
|
- name: Resolve version
|
|
id: vars
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "release" ]; then
|
|
VERSION="${{ github.event.release.tag_name }}"
|
|
else
|
|
VERSION="${{ inputs.version }}"
|
|
fi
|
|
|
|
VERSION="${VERSION#v}"
|
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Determine latest
|
|
id: latest
|
|
run: |
|
|
./scripts/release/main.ts --version "${{ steps.vars.outputs.version }}" --print-latest --output "$GITHUB_OUTPUT"
|
|
|
|
binaries:
|
|
name: "Build Binaries"
|
|
needs: [setup]
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- platform: linux
|
|
target: x86_64-unknown-linux-musl
|
|
binary_ext: ""
|
|
arch: x86_64
|
|
- platform: windows
|
|
target: x86_64-pc-windows-gnu
|
|
binary_ext: ".exe"
|
|
arch: x86_64
|
|
- platform: macos
|
|
target: x86_64-apple-darwin
|
|
binary_ext: ""
|
|
arch: x86_64
|
|
- platform: macos
|
|
target: aarch64-apple-darwin
|
|
binary_ext: ""
|
|
arch: aarch64
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build binary
|
|
run: |
|
|
docker/release/build.sh ${{ matrix.target }}
|
|
ls -la dist/
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: binary-${{ matrix.target }}
|
|
path: dist/sandbox-agent-${{ matrix.target }}${{ matrix.binary_ext }}
|
|
|
|
publish:
|
|
name: "Publish Packages"
|
|
needs: [setup, binaries]
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- 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:
|
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
run: |
|
|
VERSION="${{ needs.setup.outputs.version }}"
|
|
./scripts/release/main.ts --version "$VERSION" \
|
|
--publish-crates \
|
|
--publish-npm-sdk \
|
|
--publish-npm-cli
|
|
|
|
artifacts:
|
|
name: "Upload Artifacts"
|
|
needs: [setup, binaries]
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Install tsx
|
|
run: npm install -g tsx
|
|
|
|
- name: Install AWS CLI
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y unzip curl
|
|
|
|
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
|
|
unzip awscliv2.zip
|
|
sudo ./aws/install --update
|
|
|
|
- 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 }}
|
|
run: |
|
|
VERSION="${{ needs.setup.outputs.version }}"
|
|
if [ "${{ needs.setup.outputs.latest }}" = "true" ]; then
|
|
LATEST_FLAG="--latest"
|
|
else
|
|
LATEST_FLAG="--no-latest"
|
|
fi
|
|
|
|
./scripts/release/main.ts --version "$VERSION" $LATEST_FLAG \
|
|
--upload-typescript \
|
|
--upload-install \
|
|
--upload-binaries
|