Skip to content

refactor: restructure CI workflows and rename ui package to cli #2

refactor: restructure CI workflows and rename ui package to cli

refactor: restructure CI workflows and rename ui package to cli #2

Workflow file for this run

name: Build
on:
push:
branches: [main, dev]
tags: ['v*']
pull_request:
branches: [main, dev]
workflow_dispatch:
jobs:
# 多平台二进制构建
build-binary:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux builds
- os: ubuntu-latest
target: linux-x64
artifact: memo-linux-x64
- os: ubuntu-latest
target: linux-arm64
artifact: memo-linux-arm64
# macOS builds
- os: macos-latest
target: darwin-x64
artifact: memo-darwin-x64
- os: macos-latest
target: darwin-arm64
artifact: memo-darwin-arm64
# Windows build
- os: windows-latest
target: windows-x64
artifact: memo-windows-x64.exe
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
- name: Install ripgrep (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y ripgrep
- name: Install ripgrep (macOS)
if: runner.os == 'macOS'
run: brew install ripgrep
- name: Install ripgrep (Windows)
if: runner.os == 'Windows'
run: choco install ripgrep -y
- name: Install dependencies
run: bun install
- name: Build binary (Unix)
if: runner.os != 'Windows'
run: bun build packages/cli/src/index.tsx --target=bun --compile --outfile=${{ matrix.artifact }}
- name: Build binary (Windows)
if: runner.os == 'Windows'
run: bun build packages/cli/src/index.tsx --target=bun --compile --outfile=${{ matrix.artifact }}
- name: Test binary (Unix)
if: runner.os != 'Windows'
run: ./${{ matrix.artifact }} --help
- name: Test binary (Windows)
if: runner.os == 'Windows'
run: .\${{ matrix.artifact }} --help
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: ${{ matrix.artifact }}
retention-days: 7
# 汇总构建结果
build-summary:
name: Build Summary
runs-on: ubuntu-latest
needs: build-binary
if: always()
steps:
- name: Check build status
run: |
echo "All builds completed"
if [ "${{ needs.build-binary.result }}" != "success" ]; then
echo "Some builds failed"
exit 1
fi