Skip to content

Commit 8d95855

Browse files
committed
fix(updater): use separate yml files for Windows architectures
- Windows x64: uses default latest.yml - Windows ARM64: uses channel 'arm64' -> latest-arm64.yml - Removed complex merge script that was causing CI failures - This ensures backward compatibility with older versions
1 parent 6885a22 commit 8d95855

2 files changed

Lines changed: 18 additions & 16 deletions

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,11 @@ jobs:
143143
shell: bash
144144
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
145145

146-
- name: Merge Windows update metadata
146+
- name: List artifacts for debugging
147147
shell: bash
148148
run: |
149-
x64_yml=$(find artifacts -name "latest.yml" -path "*/win-x64-build/*" | head -1)
150-
arm64_yml=$(find artifacts -name "latest-arm64.yml" -path "*/win-arm64-build/*" | head -1)
151-
if [ -n "$x64_yml" ] && [ -n "$arm64_yml" ]; then
152-
echo "Merging Windows ARM64 metadata into latest.yml..."
153-
python3 -c "import sys, re; x, a = sys.argv[1:3]; xc = open(x).read(); ac = open(a).read(); m = re.search(r'(\s+-\s+url:.*?arm64\.exe.*?\n\s+sha512:.*?\n\s+size:.*?\n)', ac, re.S); open(x, 'w').write(re.sub(r'(files:\s*\n\s+-\s+url:.*?\n\s+sha512:.*?\n\s+size:.*?\n)', r'\1' + m.group(1), xc, flags=re.S)) if m else print('Warning: No ARM64 entry found')" "$x64_yml" "$arm64_yml"
154-
rm -f "$arm64_yml"
155-
fi
149+
echo "=== Artifact structure ==="
150+
find artifacts -type f -name "*.yml" -o -name "*.exe" -o -name "*.dmg" | head -50
156151
157152
- name: Create Release
158153
uses: softprops/action-gh-release@v1

src/main/updater.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,22 @@ export function initUpdater(win: BrowserWindow) {
248248
autoUpdater.autoDownload = false;
249249
autoUpdater.autoInstallOnAppQuit = true;
250250

251-
// electron-updater default behavior (no channel override needed):
252-
// electron-updater 默认行为(不需要覆盖 channel):
253-
// - Windows: looks for 'latest.yml'
254-
// - macOS: looks for 'latest-mac.yml'
255-
// - Linux: looks for 'latest-linux.yml'
251+
// electron-updater channel configuration:
252+
// electron-updater channel 配置:
253+
// - Windows x64: uses default 'latest.yml'
254+
// - Windows ARM64: uses 'arm64' channel -> 'latest-arm64.yml'
255+
// - macOS: uses default 'latest-mac.yml'
256+
// - Linux: uses default 'latest-linux.yml'
256257
//
257-
// Our CI generates these files with the correct names.
258-
// 我们的 CI 会生成这些正确命名的文件。
259-
console.log(`[Updater] Platform: ${process.platform}, Arch: ${process.arch}`);
258+
// This ensures backward compatibility with older versions that don't set channel.
259+
// 这确保了与旧版本的向后兼容性(旧版本不设置 channel)。
260+
if (process.platform === 'win32' && process.arch === 'arm64') {
261+
autoUpdater.channel = 'arm64';
262+
console.log(`[Updater] Windows ARM64 detected, using channel: arm64`);
263+
} else {
264+
console.log(`[Updater] Platform: ${process.platform}, Arch: ${process.arch}, using default channel`);
265+
}
266+
260267

261268
// Update check error
262269
// 检查更新出错

0 commit comments

Comments
 (0)