Files
oh-my-pi/.github/workflows/publish.yml
T
can1357 301f52c716 ci(publish): consolidated cross-platform build to single runner
- Removed matrix strategy; all binaries built on ubuntu-latest
- Added cross-platform native binding installation for bun
- Simplified artifact handling by building directly in packages/coding-agent/binaries
- Added tag input for workflow_dispatch
2026-01-07 03:04:25 +01:00

100 lines
3.0 KiB
YAML

name: Publish
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Tag to build (e.g., v0.12.0)'
required: true
type: string
skip_npm:
description: 'Skip npm publish (build binaries only)'
type: boolean
default: false
permissions:
contents: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
env:
RELEASE_TAG: ${{ github.event.inputs.tag || github.ref_name }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ env.RELEASE_TAG }}
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: bun install
- name: Install cross-platform native bindings
run: |
# bun install only installs optional deps for the current platform
# We need all platform bindings for bun cross-compilation
bun install --os darwin --cpu arm64
bun install --os darwin --cpu x64
bun install --os linux --cpu arm64
bun install --os win32 --cpu x64
- name: Build binaries for all platforms
run: |
cd packages/coding-agent
mkdir -p binaries
echo "Building for darwin-arm64..."
bun build --compile --target=bun-darwin-arm64 ./src/cli.ts --outfile binaries/omp-darwin-arm64
echo "Building for darwin-x64..."
bun build --compile --target=bun-darwin-x64 ./src/cli.ts --outfile binaries/omp-darwin-x64
echo "Building for linux-x64..."
bun build --compile --target=bun-linux-x64 ./src/cli.ts --outfile binaries/omp-linux-x64
echo "Building for linux-arm64..."
bun build --compile --target=bun-linux-arm64 ./src/cli.ts --outfile binaries/omp-linux-arm64
echo "Building for windows-x64..."
bun build --compile --target=bun-windows-x64 ./src/cli.ts --outfile binaries/omp-windows-x64.exe
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: packages/coding-agent/binaries/*
generate_release_notes: true
- name: Publish packages to npm
if: ${{ !inputs.skip_npm }}
env:
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
for pkg in packages/*/; do
pkg_name=$(basename "$pkg")
echo "Publishing $pkg_name..."
output=$(cd "$pkg" && bun publish --access public 2>&1) && echo "$output" && continue
echo "$output"
if echo "$output" | grep -q "previously published\|cannot publish over\|You cannot publish over"; then
echo "✓ Already published, skipping"
else
echo "✗ Failed to publish $pkg_name"
exit 1
fi
done