Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Build macOS

on:
workflow_dispatch:

permissions:
contents: write

jobs:
build-macos:
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
arch: Apple Silicon (M1/M2/M3/M4)
- target: x86_64-apple-darwin
arch: Intel Mac

runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22"

- name: Install frontend dependencies
working-directory: apps/codex-plus-manager
run: npm install --package-lock=false

- name: Build frontend
working-directory: apps/codex-plus-manager
run: npm run vite:build
env:
NODE_OPTIONS: --max-old-space-size=4096

- name: Build binaries
run: cargo build --release --target ${{ matrix.target }}

- name: Package as .app bundles
env:
VERSION: "1.1.8"
run: bash scripts/installer/macos/package-dmg.sh "$VERSION" "${{ matrix.arch }}"

- name: Create output directory
run: mkdir -p dist/macos

- name: Move .app bundles to dist
run: |
mv dist/macos-unpacked/*.app dist/macos/ 2>/dev/null || true
mv dist/macos/*.app dist/macos/ 2>/dev/null || true

- name: List artifacts
run: find dist/macos -type f \( -name "*.app" -o -name "*.dmg" \) | head -10

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: macos-${{ matrix.arch }}-binaries
path: dist/macos/
retention-days: 7

create-release:
needs: build-macos
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

- name: List downloaded artifacts
run: find artifacts -type f | head -20

- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: macos-build
name: macOS Build
draft: true
files: |
artifacts/**/*
Binary file modified apps/codex-plus-manager/src-tauri/icons/icon.ico
Binary file not shown.
Binary file modified apps/codex-plus-manager/src-tauri/icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 21 additions & 4 deletions scripts/installer/macos/package-dmg.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env bash
set -euo pipefail

VERSION="${1:-0.0.0}"
Expand All @@ -7,6 +7,12 @@ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
DIST="$ROOT/dist/macos"
STAGE="$DIST/stage"
BINARY_DIR="${BINARY_DIR:-$ROOT/target/release}"
# Auto-detect cross-compile target directory
if [ -d "$ROOT/target/aarch64-apple-darwin/release" ]; then
BINARY_DIR="$ROOT/target/aarch64-apple-darwin/release"
elif [ -d "$ROOT/target/x86_64-apple-darwin/release" ]; then
BINARY_DIR="$ROOT/target/x86_64-apple-darwin/release"
fi
DMG="$DIST/CodexPlusPlus-${VERSION}-macos-${ARCH}.dmg"
ICON_SOURCE="$ROOT/apps/codex-plus-manager/src-tauri/icons/icon.png"
ICON_NAME="codex-plus-plus.icns"
Expand Down Expand Up @@ -78,16 +84,27 @@ PLIST

sign_app() {
local app_dir="$1"
codesign --force --deep --sign - "$app_dir"
codesign --force --deep --sign - "$app_dir" 2>/dev/null || true
}

prepare_icon

# Detect actual arch from binary path
if echo "$BINARY_DIR" | grep -q "aarch64"; then
APP_ARCH="arm64"
elif echo "$BINARY_DIR" | grep -q "x86_64"; then
APP_ARCH="x86_64"
else
APP_ARCH="$ARCH"
fi

create_app "Codex++" "CodexPlusPlus" "$BINARY_DIR/codex-plus-plus" "com.bigpizzav3.codexplusplus" "true"
create_app "Codex++ 管理工具" "CodexPlusPlusManager" "$BINARY_DIR/codex-plus-plus-manager" "com.bigpizzav3.codexplusplus.manager" "false"
create_app "Codex++ Manager" "CodexPlusPlusManager" "$BINARY_DIR/codex-plus-plus-manager" "com.bigpizzav3.codexplusplus.manager" "false"

ln -s /Applications "$STAGE/Applications"

sign_app "$STAGE/Codex++.app"
sign_app "$STAGE/Codex++ 管理工具.app"
sign_app "$STAGE/Codex++ Manager.app"

hdiutil create -volname "Codex++" -srcfolder "$STAGE" -ov -format UDZO "$DMG"
echo "$DMG"