fix: update workflows for crossplatform bins (#2)

This commit is contained in:
Charles Packer
2025-10-24 21:51:34 -07:00
committed by GitHub
parent 51ffe5e82d
commit ae890c3b01
4 changed files with 187 additions and 17 deletions

View File

@@ -11,11 +11,45 @@ on:
- "v*"
jobs:
publish:
verify-tag:
runs-on: ubuntu-latest
environment: npm-publish
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Verify tag matches package version
if: startsWith(github.ref, 'refs/tags/')
run: |
PKG_VERSION=$(jq -r '.version' package.json)
TAG_VERSION=${GITHUB_REF#refs/tags/}
if [ "v${PKG_VERSION}" != "${TAG_VERSION}" ]; then
echo "Tag (${TAG_VERSION}) does not match package.json version (v${PKG_VERSION})."
exit 1
fi
build:
needs: verify-tag
name: ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- name: macOS arm64
runner: macos-14
binary: letta-macos-arm64
- name: macOS x64
runner: macos-13
binary: letta-macos-x64
- name: Linux x64
runner: ubuntu-24.04
binary: letta-linux-x64
- name: Linux arm64
runner: ubuntu-24.04-arm
binary: letta-linux-arm64
- name: Windows x64
runner: windows-latest
binary: letta-windows-x64.exe
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -28,23 +62,72 @@ jobs:
- name: Install dependencies
run: bun install
- name: Verify tag matches package version
if: startsWith(github.ref, 'refs/tags/')
run: |
PKG_VERSION=$(jq -r '.version' package.json)
TAG_VERSION=${GITHUB_REF#refs/tags/}
if [ "v${PKG_VERSION}" != "${TAG_VERSION}" ]; then
echo "Tag (${TAG_VERSION}) does not match package.json version (v${PKG_VERSION})."
exit 1
fi
- name: Build binary
run: bun run build
- name: Rename binary
shell: bash
run: |
if [[ "${{ matrix.runner }}" == windows* ]]; then
mv bin/letta.exe bin/${{ matrix.binary }}
else
mv bin/letta bin/${{ matrix.binary }}
fi
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.binary }}
path: bin/${{ matrix.binary }}
if-no-files-found: error
publish:
needs: build
runs-on: ubuntu-latest
environment: npm-publish
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.3.0
- name: Install dependencies
run: bun install
- name: Download all binary artifacts
uses: actions/download-artifact@v4
with:
path: bin-artifacts
- name: Move binaries to bin directory
run: |
mkdir -p bin
mv bin-artifacts/*/* bin/
ls -lah bin/
chmod +x bin/letta-*
- name: Smoke test - help
run: bun bin/letta.js --help
- name: Smoke test - version
run: bun bin/letta.js --version || echo "Version flag not implemented yet"
- name: Integration smoke test (real API)
env:
LETTA_API_KEY: ${{ secrets.LETTA_API_KEY }}
run: ./bin/letta --prompt "ping" --tools "" --permission-mode plan
run: bun bin/letta.js --prompt "ping" --tools "" --permission-mode plan
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
files: bin/letta-*
fail_on_unmatched_files: true
- name: Publish to npm
env: