cicy-desktop 2.1.130 → 2.1.132

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -62,6 +62,20 @@ jobs:
62
62
  - name: Install Electron build dependencies
63
63
  run: npm install --save-dev --no-audit electron@41.0.2 electron-builder@26.7.0
64
64
 
65
+ # Installer builds bundle the prebuilt SPA at src/backends/homepage-react.
66
+ # vite outputs to workers/render/dist, so rebuild + copy here — otherwise the
67
+ # AppImage ships a STALE homepage (e.g. missing the version badge). Mirrors npm-publish.yml.
68
+ - name: Build homepage SPA → src/backends/homepage-react
69
+ shell: bash
70
+ run: |
71
+ cd workers/render
72
+ npm install --no-audit --no-fund
73
+ npm run build
74
+ cd ../..
75
+ rm -rf src/backends/homepage-react/assets src/backends/homepage-react/index.html
76
+ cp -r workers/render/dist/. src/backends/homepage-react/
77
+ echo "homepage bundle: $(grep -o 'assets/index-[A-Za-z0-9_-]*\.js' src/backends/homepage-react/index.html)"
78
+
65
79
  - name: Build Linux app (deb + AppImage)
66
80
  shell: bash
67
81
  env:
@@ -70,6 +70,20 @@ jobs:
70
70
  - name: Install Electron build dependencies in project directory
71
71
  run: npm install --save-dev --no-audit electron@41.0.2 electron-builder@26.7.0
72
72
 
73
+ # Installer builds bundle the prebuilt SPA at src/backends/homepage-react.
74
+ # vite outputs to workers/render/dist, so rebuild + copy here — otherwise the
75
+ # dmg ships a STALE homepage (e.g. missing the version badge). Mirrors npm-publish.yml.
76
+ - name: Build homepage SPA → src/backends/homepage-react
77
+ shell: bash
78
+ run: |
79
+ cd workers/render
80
+ npm install --no-audit --no-fund
81
+ npm run build
82
+ cd ../..
83
+ rm -rf src/backends/homepage-react/assets src/backends/homepage-react/index.html
84
+ cp -r workers/render/dist/. src/backends/homepage-react/
85
+ echo "homepage bundle: $(grep -o 'assets/index-[A-Za-z0-9_-]*\.js' src/backends/homepage-react/index.html)"
86
+
73
87
  - name: Prepare macOS icon
74
88
  shell: bash
75
89
  # cicy-ai.com sometimes returns 522 (origin unreachable). Don't let an
@@ -32,6 +32,20 @@ jobs:
32
32
  - name: Install Electron build dependencies in project directory
33
33
  run: npm install --save-dev --no-audit electron@41.0.2 electron-builder@26.7.0
34
34
 
35
+ # Installer builds bundle the prebuilt SPA at src/backends/homepage-react.
36
+ # vite outputs to workers/render/dist, so rebuild + copy here — otherwise the
37
+ # exe ships a STALE homepage (e.g. missing the version badge). Mirrors npm-publish.yml.
38
+ - name: Build homepage SPA → src/backends/homepage-react
39
+ shell: bash
40
+ run: |
41
+ cd workers/render
42
+ npm install --no-audit --no-fund
43
+ npm run build
44
+ cd ../..
45
+ rm -rf src/backends/homepage-react/assets src/backends/homepage-react/index.html
46
+ cp -r workers/render/dist/. src/backends/homepage-react/
47
+ echo "homepage bundle: $(grep -o 'assets/index-[A-Za-z0-9_-]*\.js' src/backends/homepage-react/index.html)"
48
+
35
49
  - name: Prepare Windows icon
36
50
  shell: powershell
37
51
  continue-on-error: true
@@ -95,15 +109,18 @@ jobs:
95
109
  path: dist/*.exe
96
110
  if-no-files-found: error
97
111
 
98
- # 把最新的安装 exe 推到 OSS 的**单一固定 key**(主人:latest 只发一个)
99
- # 每次发版覆盖同一个文件,永远只有一个 latest,URL 不变:
100
- # https://cicy-1372193042-cn.oss-cn-shanghai.aliyuncs.com/releases/cicy-desktop-latest.exe
101
- - name: Upload latest EXE to OSS (single 'latest' file, overwritten)
112
+ # exe OSS。三件事(不再是"永远一个版本"):
113
+ # 1) 带版本号的永久副本 releases/cicy-desktop-<version>.exe — 历史 / 指定版本 / 回滚
114
+ # 2) latest 指针 releases/cicy-desktop-latest.exe — 只前进:本次版本 < 已发布版本(更旧的
115
+ # 构建后完成)则不覆盖,避免并发构建竞态把 latest 退回旧版
116
+ # 3) releases/latest-version.txt — 记录 latest 当前是哪个版本,curl 一下即可核对,无需猜 exe
117
+ - name: Upload EXE to OSS (versioned + forward-only latest pointer)
102
118
  shell: pwsh
103
119
  env:
104
120
  OSS_AK: ${{ secrets.OSS_ACCESS_KEY_ID }}
105
121
  OSS_SK: ${{ secrets.OSS_ACCESS_KEY_SECRET }}
106
122
  run: |
123
+ $version = "${{ steps.meta.outputs.version }}"
107
124
  Invoke-WebRequest -Uri "https://gosspublic.alicdn.com/ossutil/1.7.18/ossutil-v1.7.18-windows-amd64.zip" -OutFile ossutil.zip
108
125
  Expand-Archive -LiteralPath ossutil.zip -DestinationPath ossutil-dir -Force
109
126
  $oss = "ossutil-dir\ossutil-v1.7.18-windows-amd64\ossutil.exe"
@@ -111,10 +128,50 @@ jobs:
111
128
  $exe = Get-ChildItem dist\*.exe | Where-Object { $_.Name -match 'Setup' } | Select-Object -First 1
112
129
  if (-not $exe) { $exe = Get-ChildItem dist\*.exe | Select-Object -First 1 }
113
130
  if (-not $exe) { Write-Error "no exe found in dist"; exit 1 }
114
- Write-Host "Uploading $($exe.Name) -> oss://cicy-1372193042-cn/releases/cicy-desktop-latest.exe"
115
- & $oss cp "$($exe.FullName)" "oss://cicy-1372193042-cn/releases/cicy-desktop-latest.exe" -f --acl public-read
116
- if ($LASTEXITCODE -ne 0) { Write-Error "ossutil upload failed"; exit 1 }
117
- Write-Host "Latest EXE: https://cicy-1372193042-cn.oss-cn-shanghai.aliyuncs.com/releases/cicy-desktop-latest.exe"
131
+ $base = "oss://cicy-1372193042-cn/releases"
132
+
133
+ # 1) 永久版本化副本(unique key 不会被后续发版覆盖)
134
+ $verKey = "$base/cicy-desktop-$version.exe"
135
+ Write-Host "Uploading versioned -> $verKey"
136
+ & $oss cp "$($exe.FullName)" "$verKey" -f --acl public-read
137
+ if ($LASTEXITCODE -ne 0) { Write-Error "versioned upload failed"; exit 1 }
138
+
139
+ # 2) latest 指针 — 只在本次版本 >= 已发布版本时前进
140
+ & $oss cp "$base/latest-version.txt" "current-latest.txt" -f 2>$null
141
+ $cur = if (Test-Path "current-latest.txt") { (Get-Content "current-latest.txt" -Raw).Trim() } else { "0.0.0" }
142
+ $advance = $true
143
+ try { $advance = ([version]$version -ge [version]$cur) } catch { $advance = $true }
144
+ if ($advance) {
145
+ Write-Host "Advancing latest: $cur -> $version"
146
+ & $oss cp "$($exe.FullName)" "$base/cicy-desktop-latest.exe" -f --acl public-read
147
+ if ($LASTEXITCODE -ne 0) { Write-Error "latest upload failed"; exit 1 }
148
+ Set-Content -NoNewline -Path "current-latest.txt" -Value $version
149
+ & $oss cp "current-latest.txt" "$base/latest-version.txt" -f --acl public-read
150
+ if ($LASTEXITCODE -ne 0) { Write-Error "latest-version.txt upload failed"; exit 1 }
151
+ } else {
152
+ Write-Host "Skip latest: building $version < published $cur (older build — not clobbering newer latest)"
153
+ }
154
+
155
+ # 3) 保留策略 — 只留最近 $KEEP 个版本化 exe(~130MB/个),旧的删掉,避免 OSS 无限膨胀。
156
+ # latest.exe / latest-version.txt 不在此列(名字不匹配 X.Y.Z),永远保留。
157
+ $KEEP = 2
158
+ $versions = @()
159
+ foreach ($l in (& $oss ls "$base/" 2>$null)) {
160
+ if ($l -match 'releases/cicy-desktop-(\d+\.\d+\.\d+)\.exe\s*$') { $versions += $matches[1] }
161
+ }
162
+ $sorted = @($versions | Sort-Object { [version]$_ } -Descending)
163
+ if ($sorted.Count -gt $KEEP) {
164
+ foreach ($v in ($sorted | Select-Object -Skip $KEEP)) {
165
+ Write-Host "Pruning old versioned exe: cicy-desktop-$v.exe"
166
+ & $oss rm "$base/cicy-desktop-$v.exe" -f 2>$null
167
+ }
168
+ } else {
169
+ Write-Host "Retention: $($sorted.Count) versioned exe(s) <= keep $KEEP, nothing to prune"
170
+ }
171
+
172
+ Write-Host "Versioned : https://cicy-1372193042-cn.oss-cn-shanghai.aliyuncs.com/releases/cicy-desktop-$version.exe"
173
+ Write-Host "Latest : https://cicy-1372193042-cn.oss-cn-shanghai.aliyuncs.com/releases/cicy-desktop-latest.exe"
174
+ Write-Host "Version-of: https://cicy-1372193042-cn.oss-cn-shanghai.aliyuncs.com/releases/latest-version.txt"
118
175
 
119
176
  - name: Publish release (drop draft, mark latest)
120
177
  # Only promote AFTER all assets uploaded successfully. autoUpdater on
package/bin/cicy-desktop CHANGED
@@ -7,6 +7,14 @@ const isWindows = process.platform === "win32";
7
7
  const { MasterTokenManager } = require("../src/master/master-main");
8
8
  const { version: CLI_VERSION } = require("../package.json");
9
9
 
10
+ // Windows consoles default to a legacy OEM codepage (936/GBK on zh-CN), which
11
+ // renders our UTF-8 output (emoji + 中文) as 乱码. Flip the active console to
12
+ // UTF-8 (65001) before anything prints. Best-effort: harmless if redirected,
13
+ // unsupported, or already UTF-8.
14
+ if (isWindows) {
15
+ try { execSync("chcp 65001", { stdio: "ignore" }); } catch {}
16
+ }
17
+
10
18
  const HOME = os.homedir();
11
19
  const DESKTOP_DIR = path.join(HOME, "Desktop");
12
20
  const GLOBAL_CONFIG_FILE = path.join(HOME, "global.json");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cicy-desktop",
3
- "version": "2.1.130",
3
+ "version": "2.1.132",
4
4
  "description": "CiCy - AI-powered operating system browser",
5
5
  "main": "src/main.js",
6
6
  "bin": {