Skip to content

Commit 04fee9d

Browse files
committed
fix: stabilize desktop and ios release builds
1 parent d339f67 commit 04fee9d

5 files changed

Lines changed: 14 additions & 21 deletions

File tree

.github/workflows/electron-release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ jobs:
7676
run: pnpm install --frozen-lockfile
7777

7878
# 用 bash + pnpm exec,避免 pwsh 下子进程 cwd/退出码异常;ci-win.json 显式 directories.output
79-
- name: Build Windows (portable + NSIS)
79+
- name: Build Windows (NSIS installer)
8080
working-directory: desktop
8181
shell: bash
8282
run: |
8383
set -euxo pipefail
8484
pwd
8585
test -f package.json
8686
test -f electron/main.cjs
87-
pnpm exec electron-builder --win portable --x64 --publish never -c electron-builder.ci-win.json
87+
pnpm exec electron-builder --win nsis --x64 --publish never -c electron-builder.ci-win.json
8888
if [[ ! -d release ]]; then
8989
echo "electron-builder 已结束但 ./release 不存在,当前目录:"
9090
ls -la
@@ -94,12 +94,12 @@ jobs:
9494
9595
- name: Rename Windows artifact
9696
shell: bash
97-
run: cp "$(ls desktop/release/*.exe | head -1)" desktop/release/MonkeyCode-windows-x86.exe
97+
run: cp "$(ls desktop/release/*.exe | head -1)" desktop/release/MonkeyCode-windows.exe
9898

9999
- uses: actions/upload-artifact@v4
100100
with:
101101
name: electron-windows-x64
102-
path: desktop/release/MonkeyCode-windows-x86.exe
102+
path: desktop/release/MonkeyCode-windows.exe
103103
if-no-files-found: error
104104

105105
electron-macos:
@@ -241,7 +241,7 @@ jobs:
241241
shell: bash
242242
run: |
243243
mkdir -p mobile/release-apk
244-
cp mobile/android/app/build/outputs/apk/release/app-release.apk mobile/release-apk/MonkeyCode-android-arm64.apk
244+
cp mobile/android/app/build/outputs/apk/release/app-release.apk mobile/release-apk/MonkeyCode-android.apk
245245
ls -lh mobile/release-apk/
246246
247247
- uses: actions/upload-artifact@v4

desktop/electron/main.cjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const path = require("path")
44

55
const isDev = !app.isPackaged
66
const DEFAULT_PROD_URL = "https://monkeycode-ai.com"
7+
const ERR_ABORTED = -3
78
/** 桌面端启动路径(相对站点根),可用 MONKEYCODE_DESKTOP_START_PATH 覆盖 */
89
const START_PATH = (process.env.MONKEYCODE_DESKTOP_START_PATH || "/console/").replace(/\/$/, "") || "/console"
910

@@ -42,6 +43,10 @@ function ensureWindowVisible(win, ms = 2000) {
4243
setTimeout(show, ms)
4344
}
4445

46+
function isBenignLoadFailure(code, desc) {
47+
return code === ERR_ABORTED || desc === "ERR_ABORTED"
48+
}
49+
4550
function createWindow() {
4651
const win = new BrowserWindow({
4752
width: 1280,
@@ -64,6 +69,7 @@ function createWindow() {
6469

6570
win.webContents.on("did-fail-load", (_event, code, desc, url, isMainFrame) => {
6671
if (!isMainFrame) return
72+
if (isBenignLoadFailure(code, desc)) return
6773
if (!win.isDestroyed() && !win.isVisible()) win.show()
6874
if (isDev) return
6975
dialog.showErrorBox(

mobile/ios/App/App.xcodeproj/project.pbxproj

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
2FAD9763203C412B000D30F8 /* config.xml in Resources */ = {isa = PBXBuildFile; fileRef = 2FAD9762203C412B000D30F8 /* config.xml */; };
1111
50379B232058CBB4000EE86E /* capacitor.config.json in Resources */ = {isa = PBXBuildFile; fileRef = 50379B222058CBB4000EE86E /* capacitor.config.json */; };
1212
504EC3081FED79650016851F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504EC3071FED79650016851F /* AppDelegate.swift */; };
13-
504EC30D1FED79650016851F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 504EC30B1FED79650016851F /* Main.storyboard */; };
1413
504EC30F1FED79650016851F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 504EC30E1FED79650016851F /* Assets.xcassets */; };
1514
504EC3121FED79650016851F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 504EC3101FED79650016851F /* LaunchScreen.storyboard */; };
1615
50B271D11FEDC1A000F3C39B /* public in Resources */ = {isa = PBXBuildFile; fileRef = 50B271D01FEDC1A000F3C39B /* public */; };
@@ -22,7 +21,6 @@
2221
50379B222058CBB4000EE86E /* capacitor.config.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = capacitor.config.json; sourceTree = "<group>"; };
2322
504EC3041FED79650016851F /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; };
2423
504EC3071FED79650016851F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
25-
504EC30C1FED79650016851F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
2624
504EC30E1FED79650016851F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
2725
504EC3111FED79650016851F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
2826
504EC3131FED79650016851F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -75,7 +73,6 @@
7573
children = (
7674
50379B222058CBB4000EE86E /* capacitor.config.json */,
7775
504EC3071FED79650016851F /* AppDelegate.swift */,
78-
504EC30B1FED79650016851F /* Main.storyboard */,
7976
504EC30E1FED79650016851F /* Assets.xcassets */,
8077
504EC3101FED79650016851F /* LaunchScreen.storyboard */,
8178
504EC3131FED79650016851F /* Info.plist */,
@@ -161,7 +158,6 @@
161158
50B271D11FEDC1A000F3C39B /* public in Resources */,
162159
504EC30F1FED79650016851F /* Assets.xcassets in Resources */,
163160
50379B232058CBB4000EE86E /* capacitor.config.json in Resources */,
164-
504EC30D1FED79650016851F /* Main.storyboard in Resources */,
165161
2FAD9763203C412B000D30F8 /* config.xml in Resources */,
166162
);
167163
runOnlyForDeploymentPostprocessing = 0;
@@ -216,14 +212,6 @@
216212
/* End PBXSourcesBuildPhase section */
217213

218214
/* Begin PBXVariantGroup section */
219-
504EC30B1FED79650016851F /* Main.storyboard */ = {
220-
isa = PBXVariantGroup;
221-
children = (
222-
504EC30C1FED79650016851F /* Base */,
223-
);
224-
name = Main.storyboard;
225-
sourceTree = "<group>";
226-
};
227215
504EC3101FED79650016851F /* LaunchScreen.storyboard */ = {
228216
isa = PBXVariantGroup;
229217
children = (

mobile/ios/App/App/AppDelegate.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ import Capacitor
33

44
@UIApplicationMain
55
class AppDelegate: UIResponder, UIApplicationDelegate {
6-
76
var window: UIWindow?
87

98
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
10-
// Override point for customization after application launch.
9+
window = UIWindow(frame: UIScreen.main.bounds)
10+
window?.rootViewController = CAPBridgeViewController()
11+
window?.makeKeyAndVisible()
1112
return true
1213
}
1314

mobile/ios/App/App/Info.plist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
<false/>
2727
<key>UILaunchStoryboardName</key>
2828
<string>LaunchScreen</string>
29-
<key>UIMainStoryboardFile</key>
30-
<string>Main</string>
3129
<key>UIRequiredDeviceCapabilities</key>
3230
<array>
3331
<string>armv7</string>

0 commit comments

Comments
 (0)