ci: upload binaries on workflow_dispatch too #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Platform Binaries | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build-platform: | |
| name: Build ${{ matrix.slug }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| slug: codemachine-linux-x64 | |
| - os: ubuntu-latest | |
| slug: codemachine-linux-arm64 | |
| target: linux-arm64 | |
| - os: macos-14 | |
| slug: codemachine-darwin-arm64 | |
| - os: macos-14 | |
| slug: codemachine-darwin-x64 | |
| target: darwin-x64 | |
| - os: windows-latest | |
| slug: codemachine-windows-x64 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Read Bun version from package.json | |
| id: bun-version | |
| shell: bash | |
| run: echo "version=$(jq -r '.engines.bun' package.json)" >> $GITHUB_OUTPUT | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v1 | |
| with: | |
| bun-version: ${{ steps.bun-version.outputs.version }} | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Build platform binary | |
| shell: bash | |
| run: | | |
| if [ -n "${{ matrix.target }}" ]; then | |
| bun run build --target ${{ matrix.target }} | |
| else | |
| bun run build | |
| fi | |
| - name: Verify cm alias in package.json | |
| shell: bash | |
| run: | | |
| if ! grep -q '"cm"' binaries/${{ matrix.slug }}/package.json; then | |
| echo "❌ ERROR: 'cm' alias missing from binaries/${{ matrix.slug }}/package.json" | |
| exit 1 | |
| fi | |
| echo "✅ cm alias verified in package.json" | |
| - name: Test binary execution (Unix) | |
| if: runner.os != 'Windows' && matrix.target == '' | |
| continue-on-error: true | |
| run: | | |
| chmod +x binaries/${{ matrix.slug }}/codemachine | |
| binaries/${{ matrix.slug }}/codemachine --version || echo "⚠️ Binary execution test skipped (may require dependencies)" | |
| - name: Test binary execution (Windows) | |
| if: runner.os == 'Windows' | |
| continue-on-error: true | |
| run: | | |
| binaries/${{ matrix.slug }}/codemachine.exe --version | |
| if ($LASTEXITCODE -ne 0) { Write-Host "⚠️ Binary execution test skipped (may require dependencies)" } | |
| - name: Upload binary package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.slug }} | |
| path: binaries/${{ matrix.slug }} | |
| - name: Smoke test platform binary | |
| if: matrix.target == '' | |
| shell: bash | |
| run: | | |
| chmod +x binaries/${{ matrix.slug }}/codemachine* || true | |
| binaries/${{ matrix.slug }}/codemachine --version | |
| - name: Verify cross-compiled binary exists | |
| if: matrix.target != '' | |
| shell: bash | |
| run: | | |
| if [ -f "binaries/${{ matrix.slug }}/codemachine" ]; then | |
| echo "✅ Cross-compiled binary exists: binaries/${{ matrix.slug }}/codemachine" | |
| file binaries/${{ matrix.slug }}/codemachine | |
| else | |
| echo "❌ Binary not found" | |
| exit 1 | |
| fi |