diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1a2f664f4..ff1a5f19e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,10 +58,19 @@ jobs: ${{ runner.os }}-pnpm-store- - name: Install dependencies - run: pnpm install --frozen-lockfile + run: pnpm install - - name: Build Vite - run: pnpm run build:vite + - name: Download uv binaries for macOS + if: matrix.platform == 'mac' + run: pnpm run uv:download:mac + + - name: Download uv binaries for Windows + if: matrix.platform == 'win' + run: pnpm run uv:download:win + + - name: Download uv binaries for Linux + if: matrix.platform == 'linux' + run: pnpm run uv:download:linux # macOS specific steps - name: Build macOS @@ -80,10 +89,6 @@ jobs: ulimit -n 65536 echo "File descriptor limit: $(ulimit -n)" - # Create missing bin directories to avoid warnings - mkdir -p resources/bin/darwin-x64 - mkdir -p resources/bin/darwin-arm64 - pnpm run package:mac # Windows specific steps @@ -103,15 +108,6 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: pnpm run package:linux - - name: List build artifacts - shell: bash - run: | - echo "=== Build artifacts in release/ folder ===" - ls -lh release/ || echo "No release folder found" - echo "" - echo "=== File types generated ===" - find release/ -type f -exec file {} \; || true - - name: Upload artifacts uses: actions/upload-artifact@v4 with: diff --git a/package.json b/package.json index 05aafec50..0778ac9ec 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,10 @@ "test:e2e": "playwright test", "clean": "node -e \"['dist','dist-electron','release'].forEach(d=>require('fs').rmSync(d,{recursive:true,force:true}))\"", "uv:download": "zx scripts/download-bundled-uv.mjs", + "uv:download:mac": "zx scripts/download-bundled-uv.mjs --platform=mac", + "uv:download:win": "zx scripts/download-bundled-uv.mjs --platform=win", + "uv:download:linux": "zx scripts/download-bundled-uv.mjs --platform=linux", + "uv:download:all": "zx scripts/download-bundled-uv.mjs --all", "icons": "zx scripts/generate-icons.mjs", "package": "electron-builder", "package:mac": "vite build && zx scripts/bundle-openclaw.mjs && electron-builder --mac", diff --git a/scripts/download-bundled-uv.mjs b/scripts/download-bundled-uv.mjs index 58ae7b961..eb655d93f 100644 --- a/scripts/download-bundled-uv.mjs +++ b/scripts/download-bundled-uv.mjs @@ -17,12 +17,31 @@ const TARGETS = { filename: 'uv-x86_64-apple-darwin.tar.gz', binName: 'uv', }, + 'win32-arm64': { + filename: 'uv-aarch64-pc-windows-msvc.zip', + binName: 'uv.exe', + }, 'win32-x64': { filename: 'uv-x86_64-pc-windows-msvc.zip', binName: 'uv.exe', + }, + 'linux-arm64': { + filename: 'uv-aarch64-unknown-linux-gnu.tar.gz', + binName: 'uv', + }, + 'linux-x64': { + filename: 'uv-x86_64-unknown-linux-gnu.tar.gz', + binName: 'uv', } }; +// Platform groups for building multi-arch packages +const PLATFORM_GROUPS = { + 'mac': ['darwin-x64', 'darwin-arm64'], + 'win': ['win32-x64', 'win32-arm64'], + 'linux': ['linux-x64', 'linux-arm64'] +}; + async function setupTarget(id) { const target = TARGETS[id]; if (!target) { @@ -98,17 +117,31 @@ async function setupTarget(id) { } // Main logic -const args = process.argv.slice(3); // zx scripts/file.mjs --all -> argv is [node, zx, file, --all] ? or similar. -// zx execution: process.argv is [node, script, users_args...] -// Let's use minimist which zx includes globally as `argv` const downloadAll = argv.all; +const platform = argv.platform; if (downloadAll) { + // Download for all platforms echo(chalk.cyan`🌐 Downloading uv binaries for ALL supported platforms...`); for (const id of Object.keys(TARGETS)) { await setupTarget(id); } +} else if (platform) { + // Download for a specific platform (e.g., --platform=mac) + const targets = PLATFORM_GROUPS[platform]; + if (!targets) { + echo(chalk.red`❌ Unknown platform: ${platform}`); + echo(`Available platforms: ${Object.keys(PLATFORM_GROUPS).join(', ')}`); + process.exit(1); + } + + echo(chalk.cyan`🎯 Downloading uv binaries for platform: ${platform}`); + echo(` Architectures: ${targets.join(', ')}`); + for (const id of targets) { + await setupTarget(id); + } } else { + // Download for current system only (default for local dev) const currentId = `${os.platform()}-${os.arch()}`; echo(chalk.cyan`💻 Detected system: ${currentId}`); @@ -117,6 +150,8 @@ if (downloadAll) { } else { echo(chalk.red`❌ Current system ${currentId} is not in the supported download list.`); echo(`Supported targets: ${Object.keys(TARGETS).join(', ')}`); + echo(`\nTip: Use --platform= to download for a specific platform`); + echo(` Use --all to download for all platforms`); process.exit(1); } }