From 706147e763d9ab8cf0da46aa544c413965d477ce Mon Sep 17 00:00:00 2001 From: Jack Lee Date: Sat, 28 Feb 2026 20:54:35 +0000 Subject: [PATCH 1/2] fix: separate arm64 and x64 builds for Apple Silicon support - Split macOS CI into two runners: macos-latest (x64) and macos-14 (arm64) - Add --x64/--arm64 flag to download-pdfium.js for cross-compilation - Pass arch flag to electron-builder to build only target arch - Update author: Carme99 --- .github/workflows/release.yml | 11 ++++++++--- package.json | 2 +- scripts/download-pdfium.js | 14 ++++++++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75a247e..ecff755 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,6 +22,11 @@ jobs: artifact: release/*.AppImage - os: macos-latest platform: mac + arch: x64 + artifact: release/*.dmg + - os: macos-14 + platform: mac + arch: arm64 artifact: release/*.dmg runs-on: ${{ matrix.os }} @@ -40,7 +45,7 @@ jobs: run: npm ci - name: Download PDFium binaries - run: node scripts/download-pdfium.js + run: node scripts/download-pdfium.js --${{ matrix.arch }} - name: Build native addon run: npm run build:native @@ -49,14 +54,14 @@ jobs: run: npm run build - name: Build installer - run: npm run dist:${{ matrix.platform }} + run: npm run dist:${{ matrix.platform }} ${{ matrix.arch == 'mac' && format('-- --{0}', matrix.arch) || '' }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: installer-${{ matrix.platform }} + name: installer-${{ matrix.platform }}-${{ matrix.arch }} path: | release/*.exe release/*.dmg diff --git a/package.json b/package.json index 61f93e9..d5988d1 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "dist:linux": "electron-builder --linux", "build:msi": "node scripts/build-msi.js" }, - "author": "", + "author": "Carme99", "license": "MIT", "devDependencies": { "@playwright/test": "^1.58.2", diff --git a/scripts/download-pdfium.js b/scripts/download-pdfium.js index 9328a15..3c05083 100644 --- a/scripts/download-pdfium.js +++ b/scripts/download-pdfium.js @@ -3,7 +3,7 @@ * Download prebuilt PDFium shared library from bblanchon/pdfium-binaries. * Extracts to native/pdfium/vendor/{include,lib,bin}. * - * Usage: node scripts/download-pdfium.js + * Usage: node scripts/download-pdfium.js [--x64|--arm64] */ 'use strict'; @@ -90,7 +90,17 @@ function download(url, destPath) { } async function main() { - const key = `${process.platform}-${process.arch}`; + // Parse command-line flags for cross-compilation support + const args = process.argv.slice(2); + let arch = process.arch; // Default to current system arch + + if (args.includes('--x64')) { + arch = 'x64'; + } else if (args.includes('--arm64')) { + arch = 'arm64'; + } + + const key = `${process.platform}-${arch}`; const name = PLATFORM_MAP[key]; if (!name) { From 1de463cfa2aa2925a58da5f1dfbed63c0e044005 Mon Sep 17 00:00:00 2001 From: Jack Lee Date: Sat, 28 Feb 2026 21:01:15 +0000 Subject: [PATCH 2/2] fix: address code review comments - make arch flags conditional --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ecff755..86d24d0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,7 +45,7 @@ jobs: run: npm ci - name: Download PDFium binaries - run: node scripts/download-pdfium.js --${{ matrix.arch }} + run: node scripts/download-pdfium.js ${{ matrix.arch && format('--{0}', matrix.arch) || '' }} - name: Build native addon run: npm run build:native @@ -54,14 +54,14 @@ jobs: run: npm run build - name: Build installer - run: npm run dist:${{ matrix.platform }} ${{ matrix.arch == 'mac' && format('-- --{0}', matrix.arch) || '' }} + run: npm run dist:${{ matrix.platform }} ${{ matrix.platform == 'mac' && format('-- --{0}', matrix.arch) || '' }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: installer-${{ matrix.platform }}-${{ matrix.arch }} + name: installer-${{ matrix.platform }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }} path: | release/*.exe release/*.dmg