From cf41e2bfd91a36ac80355aaf710e108e2d0dfa07 Mon Sep 17 00:00:00 2001 From: troyeguo <13820674+troyeguo@users.noreply.github.com> Date: Tue, 12 Aug 2025 09:27:30 +0800 Subject: [PATCH] fix: update release workflow to include multiple OS targets and modify package.json for Linux x64 builds --- .github/workflows/release.yml | 18 ++++++++++++++++-- main.js | 4 ++-- package.json | 16 ++++++++++++++-- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5f119ef6..48955191 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,8 +9,7 @@ jobs: # Platforms to build on/for strategy: matrix: - os: [ubuntu-24.04-arm] - # os: [macos-latest, ubuntu-latest, windows-latest] + os: [macos-latest, ubuntu-latest, windows-latest, ubuntu-24.04-arm] steps: - name: Check out Git repository @@ -52,6 +51,21 @@ jobs: run: echo "USE_SYSTEM_FPM=true" >> $GITHUB_ENV - name: Set environment variable USE_HARD_LINKS run: echo "USE_HARD_LINKS=false" >> $GITHUB_ENV + - name: Modify package.json for Linux arm64 build + if: startsWith(matrix.os, 'ubuntu-24.04-arm') + run: | + $packageJson = Get-Content package.json -Raw | ConvertFrom-Json + $packageJson.build.linux.target = @( + @{ + target = "deb" + arch = @("arm64") + }, + @{ + target = "AppImage" + arch = @("arm64") + } + ) + $packageJson | ConvertTo-Json -Depth 10 | Set-Content package.json - name: Build/release Electron app uses: samuelmeuli/action-electron-builder@v1.6.0 with: diff --git a/main.js b/main.js index 6a47d76f..9dbb7c08 100644 --- a/main.js +++ b/main.js @@ -159,7 +159,7 @@ const createMainWin = () => { mainWin.loadURL(urlLocation); mainWin.on("close", () => { - if (!mainWin.isDestroyed()) { + if (mainWin && !mainWin.isDestroyed()) { let bounds = mainWin.getBounds(); if (bounds.width > 0 && bounds.height > 0) { store.set({ @@ -233,7 +233,7 @@ const createMainWin = () => { readerWindow.setAlwaysOnTop(true); } readerWindow.on("close", (event) => { - if (!readerWindow.isDestroyed()) { + if (readerWindow && !readerWindow.isDestroyed()) { let bounds = readerWindow.getBounds(); if (bounds.width > 0 && bounds.height > 0) { store.set({ diff --git a/package.json b/package.json index 900debb6..868c4d03 100644 --- a/package.json +++ b/package.json @@ -267,16 +267,28 @@ "icon": "assets/icons", "category": "Office", "target": [ + { + "target": "snap", + "arch": [ + "x64" + ] + }, { "target": "deb", "arch": [ - "arm64" + "x64" + ] + }, + { + "target": "rpm", + "arch": [ + "x64" ] }, { "target": "AppImage", "arch": [ - "arm64" + "x64" ] } ],