spawn/.github/workflows/cli-release.yml
A 65f6f1be32
feat: Bun workspace monorepo — packages/cli + packages/shared (#1853)
Restructure the repo as a Bun workspace monorepo:

- Move cli/ → packages/cli/
- Create packages/shared/ (@openrouter/spawn-shared) with type-guards and parse utilities
- Add root package.json with workspace configuration
- Update all CLI imports to use @openrouter/spawn-shared
- Deduplicate toRecord/toObjectArray helpers from 4 cloud modules
- Update SPA (slack-bot) to use shared package instead of local toObj()
- Update 48 agent shell scripts for new packages/cli/ path
- Update install.sh, install.ps1, e2e, and test scripts
- Update all GitHub workflows, .gitignore, pre-commit hooks
- Update CLAUDE.md, README.md, and skill prompt references
- Pin all dependency versions (no ^ ranges)
- Bump CLI version 0.9.1 → 0.10.0

All 1908 tests pass. Lint clean. All 8 cloud bundles build.

Co-authored-by: Claude <claude@anthropic.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-23 22:07:05 -08:00

87 lines
2.7 KiB
YAML

name: CLI Release
on:
push:
branches: [main]
paths:
- 'packages/cli/src/**'
- 'packages/cli/package.json'
- 'packages/cli/bun.lock'
workflow_dispatch:
concurrency:
group: cli-release
cancel-in-progress: true
jobs:
build:
name: Build and release CLI
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies and build
working-directory: packages/cli
run: |
bun install
bun run build
- name: Build cloud bundles
run: bun run packages/cli/build-clouds.ts
- name: Get version
id: version
working-directory: packages/cli
run: echo "version=$(jq -r .version package.json)" >> "$GITHUB_OUTPUT"
- name: Update cli-latest release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Delete existing release if present
gh release delete cli-latest --yes 2>/dev/null || true
git tag -d cli-latest 2>/dev/null || true
git push origin :refs/tags/cli-latest 2>/dev/null || true
# Create new release with built cli.js
gh release create cli-latest \
--title "CLI v${{ steps.version.outputs.version }}" \
--notes "Pre-built CLI binary (auto-updated on every push to main).
This release is used as a fallback by \`install.sh\` when the local build fails (e.g. Termux proot).
**Version:** ${{ steps.version.outputs.version }}
**Built:** $(date -u +%Y-%m-%dT%H:%M:%SZ)" \
--prerelease \
packages/cli/cli.js
- name: Upload cloud bundles
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Upload each cloud bundle as a separate release (fly-latest/fly.js, etc.)
for bundle in packages/cli/*.js; do
name=$(basename "$bundle" .js)
[[ "$name" == "cli" ]] && continue # skip cli.js, already uploaded above
gh release delete "${name}-latest" --yes 2>/dev/null || true
git tag -d "${name}-latest" 2>/dev/null || true
git push origin ":refs/tags/${name}-latest" 2>/dev/null || true
gh release create "${name}-latest" \
--title "${name} bundle v${{ steps.version.outputs.version }}" \
--notes "Pre-built ${name} cloud provider bundle.
Downloaded by \`sh/${name}/*.sh\` shims for \`bash <(curl ...)\` execution.
**Built:** $(date -u +%Y-%m-%dT%H:%M:%SZ)" \
--prerelease \
"$bundle"
done