spawn/.github/workflows/cli-release.yml
A 262d081756
refactor: move fly TS into cli/src/fly/, add build-clouds.sh (#1604)
Move all fly TypeScript files from fly/lib/*.ts and fly/main.ts into
cli/src/fly/. This gives them access to cli/node_modules (@clack/prompts),
biome linting, and the existing bun:test infrastructure — no symlinks or
NODE_PATH hacks needed.

The org picker now uses @clack/prompts select() directly (static import,
bundled at build time).

New: cli/build-clouds.sh — auto-discovers cli/src/*/main.ts and bundles
each into {cloud}.js. Scalable to future cloud TS migrations:
  bash cli/build-clouds.sh        # build all
  bash cli/build-clouds.sh fly    # build one

Shims now check for cli/src/fly/main.ts (local) or download fly.js from
GitHub releases (remote curl|bash).

Co-authored-by: lab <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-21 12:34:09 -08:00

82 lines
2.5 KiB
YAML

name: CLI Release
on:
push:
branches: [main]
paths:
- 'cli/src/**'
- 'cli/package.json'
- 'cli/bun.lock'
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: cli
run: |
bun install
bun run build
- name: Build cloud bundles
run: bun run cli/build-clouds.ts
- name: Get version
id: version
working-directory: 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 \
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 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 \`${name}/*.sh\` shims for \`bash <(curl ...)\` execution.
**Built:** $(date -u +%Y-%m-%dT%H:%M:%SZ)" \
--prerelease \
"$bundle"
done