mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 19:05:11 +00:00
mise auto-detects single-directory archives and extracts with strip_components=1. Using a 'pi/' wrapper directory ensures the internal structure is preserved. Reverts the code workaround (theme dir fallback) in favor of fixing the tarball.
157 lines
5.6 KiB
YAML
157 lines
5.6 KiB
YAML
name: Build Binaries
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: 'Tag to build (e.g., v0.12.0)'
|
|
required: true
|
|
type: string
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
RELEASE_TAG: ${{ github.event.inputs.tag || github.ref_name }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
with:
|
|
ref: ${{ env.RELEASE_TAG }}
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2.0.1
|
|
with:
|
|
bun-version: 1.2.20
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
|
|
with:
|
|
node-version: '22'
|
|
registry-url: 'https://registry.npmjs.org'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Install cross-platform native bindings
|
|
run: |
|
|
# npm ci only installs optional deps for the current platform (linux-x64)
|
|
# We need all platform bindings for bun cross-compilation
|
|
# Use --force to bypass platform checks (os/cpu restrictions in package.json)
|
|
|
|
# Clipboard bindings for all target platforms
|
|
npm install --no-save --force \
|
|
@mariozechner/clipboard-darwin-arm64@0.3.0 \
|
|
@mariozechner/clipboard-darwin-x64@0.3.0 \
|
|
@mariozechner/clipboard-linux-x64-gnu@0.3.0 \
|
|
@mariozechner/clipboard-linux-arm64-gnu@0.3.0 \
|
|
@mariozechner/clipboard-win32-x64-msvc@0.3.0
|
|
|
|
# Sharp bindings for all target platforms
|
|
npm install --no-save --force \
|
|
@img/sharp-darwin-arm64@0.34.5 \
|
|
@img/sharp-darwin-x64@0.34.5 \
|
|
@img/sharp-linux-x64@0.34.5 \
|
|
@img/sharp-linux-arm64@0.34.5 \
|
|
@img/sharp-win32-x64@0.34.5 \
|
|
@img/sharp-libvips-darwin-arm64@1.2.4 \
|
|
@img/sharp-libvips-darwin-x64@1.2.4 \
|
|
@img/sharp-libvips-linux-x64@1.2.4 \
|
|
@img/sharp-libvips-linux-arm64@1.2.4
|
|
|
|
- name: Build all packages
|
|
run: npm run build
|
|
|
|
- name: Build binaries for all platforms
|
|
run: |
|
|
cd packages/coding-agent
|
|
|
|
# Create output directories for each platform
|
|
mkdir -p binaries/{darwin-arm64,darwin-x64,linux-x64,linux-arm64,windows-x64}
|
|
|
|
# Build for each platform - binary is always named 'pi' (or 'pi.exe' for Windows)
|
|
echo "Building for darwin-arm64..."
|
|
bun build --compile --target=bun-darwin-arm64 ./dist/cli.js --outfile binaries/darwin-arm64/pi
|
|
|
|
echo "Building for darwin-x64..."
|
|
bun build --compile --target=bun-darwin-x64 ./dist/cli.js --outfile binaries/darwin-x64/pi
|
|
|
|
echo "Building for linux-x64..."
|
|
bun build --compile --target=bun-linux-x64 ./dist/cli.js --outfile binaries/linux-x64/pi
|
|
|
|
echo "Building for linux-arm64..."
|
|
bun build --compile --target=bun-linux-arm64 ./dist/cli.js --outfile binaries/linux-arm64/pi
|
|
|
|
echo "Building for windows-x64..."
|
|
bun build --compile --target=bun-windows-x64 ./dist/cli.js --outfile binaries/windows-x64/pi.exe
|
|
|
|
- name: Create release archives
|
|
run: |
|
|
cd packages/coding-agent
|
|
|
|
# Copy shared files to each platform directory
|
|
for platform in darwin-arm64 darwin-x64 linux-x64 linux-arm64 windows-x64; do
|
|
cp package.json binaries/$platform/
|
|
cp README.md binaries/$platform/
|
|
cp CHANGELOG.md binaries/$platform/
|
|
mkdir -p binaries/$platform/theme
|
|
cp dist/modes/interactive/theme/*.json binaries/$platform/theme/
|
|
cp -r examples binaries/$platform/
|
|
done
|
|
|
|
# Create archives
|
|
cd binaries
|
|
|
|
# Unix platforms (tar.gz) - use wrapper directory for mise compatibility
|
|
# mise auto-detects single-directory archives and strips one component
|
|
for platform in darwin-arm64 darwin-x64 linux-x64 linux-arm64; do
|
|
mv $platform pi && tar -czf pi-$platform.tar.gz pi && mv pi $platform
|
|
done
|
|
|
|
# Windows (zip)
|
|
cd windows-x64 && zip -r ../pi-windows-x64.zip . && cd ..
|
|
|
|
- name: Extract changelog for this version
|
|
id: changelog
|
|
run: |
|
|
VERSION="${RELEASE_TAG}"
|
|
VERSION="${VERSION#v}" # Remove 'v' prefix
|
|
|
|
# Extract changelog section for this version
|
|
cd packages/coding-agent
|
|
awk "/^## \[${VERSION}\]/{flag=1; next} /^## \[/{flag=0} flag" CHANGELOG.md > /tmp/release-notes.md
|
|
|
|
# If empty, use a default message
|
|
if [ ! -s /tmp/release-notes.md ]; then
|
|
echo "Release ${VERSION}" > /tmp/release-notes.md
|
|
fi
|
|
|
|
- name: Create GitHub Release and upload binaries
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
cd packages/coding-agent/binaries
|
|
|
|
# Create release with changelog notes (or update if exists)
|
|
gh release create "${RELEASE_TAG}" \
|
|
--title "${RELEASE_TAG}" \
|
|
--notes-file /tmp/release-notes.md \
|
|
pi-darwin-arm64.tar.gz \
|
|
pi-darwin-x64.tar.gz \
|
|
pi-linux-x64.tar.gz \
|
|
pi-linux-arm64.tar.gz \
|
|
pi-windows-x64.zip \
|
|
2>/dev/null || \
|
|
gh release upload "${RELEASE_TAG}" \
|
|
pi-darwin-arm64.tar.gz \
|
|
pi-darwin-x64.tar.gz \
|
|
pi-linux-x64.tar.gz \
|
|
pi-linux-arm64.tar.gz \
|
|
pi-windows-x64.zip \
|
|
--clobber
|