sandbox-agent/.github/workflows/release.yaml
2026-01-26 00:13:17 -08:00

146 lines
3.6 KiB
YAML

name: release
on:
workflow_dispatch:
inputs:
version:
description: "Version (e.g. 0.1.0 or v0.1.0)"
required: true
type: string
latest:
description: "Latest"
required: true
type: boolean
default: true
defaults:
run:
shell: bash -e {0}
env:
CARGO_INCREMENTAL: 0
jobs:
setup:
name: "Setup"
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
cache: pnpm
- name: Install tsx
run: npm install -g tsx
- name: Run setup phase
run: |
CMD="./scripts/release/main.ts --version '${{ inputs.version }}' --phase setup-ci"
if [ "${{ inputs.latest }}" != "true" ]; then
CMD="$CMD --no-latest"
fi
eval "$CMD"
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 }}
complete:
name: "Complete"
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: 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: Publish & upload artifacts
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
R2_RELEASES_ACCESS_KEY_ID: ${{ secrets.R2_RELEASES_ACCESS_KEY_ID }}
R2_RELEASES_SECRET_ACCESS_KEY: ${{ secrets.R2_RELEASES_SECRET_ACCESS_KEY }}
run: |
CMD="./scripts/release/main.ts --version '${{ inputs.version }}' --phase complete-ci --no-validate-git"
if [ "${{ inputs.latest }}" != "true" ]; then
CMD="$CMD --no-latest"
fi
eval "$CMD"