Skip to content

Commit c731101

Browse files
committed
chore: configration & rebuild system tray
Signed-off-by: 1111mp <[email protected]>
1 parent 591aba7 commit c731101

25 files changed

+1784
-1182
lines changed

.github/workflows/pre-release.yml

+360
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,360 @@
1+
name: Alpha Build
2+
3+
on: workflow_dispatch
4+
permissions: write-all
5+
6+
env:
7+
CARGO_INCREMENTAL: 0
8+
RUST_BACKTRACE: short
9+
10+
jobs:
11+
alpha:
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
include:
16+
- os: windows-latest
17+
target: x86_64-pc-windows-msvc
18+
- os: windows-latest
19+
target: aarch64-pc-windows-msvc
20+
- os: macos-latest
21+
target: aarch64-apple-darwin
22+
- os: macos-latest
23+
target: x86_64-apple-darwin
24+
- os: ubuntu-latest
25+
target: x86_64-unknown-linux-gnu
26+
27+
runs-on: ${{ matrix.os }}
28+
steps:
29+
- name: Checkout Repository
30+
uses: actions/checkout@v4
31+
32+
- name: Install Rust Stable
33+
uses: dtolnay/rust-toolchain@stable
34+
35+
- name: Add Rust Target
36+
run: rustup target add ${{ matrix.target }}
37+
38+
- name: Rust Cache
39+
uses: Swatinem/rust-cache@v2
40+
with:
41+
workspaces: src-tauri
42+
cache-all-crates: true
43+
44+
- name: Install dependencies (ubuntu only)
45+
if: matrix.os == 'ubuntu-latest'
46+
run: |
47+
sudo apt-get update
48+
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
49+
50+
- name: Install Node
51+
uses: actions/setup-node@v4
52+
with:
53+
node-version: '20'
54+
55+
- name: Install pnpm
56+
uses: pnpm/action-setup@v4
57+
with:
58+
run_install: false
59+
60+
- name: Pnpm install and check
61+
run: |
62+
pnpm i
63+
pnpm check ${{ matrix.target }}
64+
65+
- name: Tauri Build
66+
uses: tauri-apps/tauri-action@v0
67+
env:
68+
NODE_OPTIONS: '--max_old_space_size=4096'
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
71+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
72+
with:
73+
tagName: v__VERSION__-alpha
74+
releaseName: 'NVM Desktop v__VERSION__-alpha'
75+
releaseBody: 'More new features are now supported.'
76+
releaseDraft: false
77+
prerelease: true
78+
tauriScript: pnpm
79+
args: --target ${{ matrix.target }}
80+
81+
alpha-for-linux-arm64:
82+
strategy:
83+
fail-fast: false
84+
matrix:
85+
include:
86+
- os: ubuntu-latest
87+
target: aarch64-unknown-linux-gnu
88+
runs-on: ${{ matrix.os }}
89+
steps:
90+
- name: Checkout Repository
91+
uses: actions/checkout@v4
92+
93+
- name: Install Rust Stable
94+
uses: dtolnay/rust-toolchain@stable
95+
96+
- name: Add Rust Target
97+
run: rustup target add ${{ matrix.target }}
98+
99+
- name: Rust Cache
100+
uses: Swatinem/rust-cache@v2
101+
with:
102+
workspaces: src-tauri
103+
cache-all-crates: true
104+
105+
- name: Install Node
106+
uses: actions/setup-node@v4
107+
with:
108+
node-version: '20'
109+
110+
- name: Install pnpm
111+
uses: pnpm/action-setup@v4
112+
with:
113+
run_install: false
114+
115+
- name: Pnpm install and check
116+
run: |
117+
pnpm i
118+
pnpm check ${{ matrix.target }}
119+
120+
- name: 'Setup for linux'
121+
run: |-
122+
sudo ls -lR /etc/apt/
123+
echo -------------
124+
# sudo sed 's/mirror+file:\/etc\/apt\/apt-mirrors.txt/[arch-=amd64,i386] http:\/\/ports.ubuntu.com\/ubuntu-ports\//g' /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/ports.list
125+
# echo -------------
126+
# sudo sed -i 's/mirror+file:\/etc\/apt\/apt-mirrors.txt/[arch=amd64,i386] http:\/\/archive.ubuntu.com\/ubuntu\//g' /etc/apt/sources.list
127+
cat > /tmp/sources.list << EOF
128+
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy main multiverse universe restricted
129+
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy-security main multiverse universe restricted
130+
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy-updates main multiverse universe restricted
131+
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy-backports main multiverse universe restricted
132+
133+
deb [arch-=amd64,i386] http://ports.ubuntu.com/ubuntu-ports jammy main multiverse universe restricted
134+
deb [arch-=amd64,i386] http://ports.ubuntu.com/ubuntu-ports jammy-security main multiverse universe restricted
135+
deb [arch-=amd64,i386] http://ports.ubuntu.com/ubuntu-ports jammy-updates main multiverse universe restricted
136+
deb [arch-=amd64,i386] http://ports.ubuntu.com/ubuntu-ports jammy-backports main multiverse universe restricted
137+
EOF
138+
sudo mv /etc/apt/sources.list /etc/apt/sources.list.default
139+
sudo mv /tmp/sources.list /etc/apt/sources.list
140+
141+
echo -------------
142+
echo /etc/apt/sources.list && cat /etc/apt/sources.list
143+
echo -------------
144+
echo /etc/apt/apt-mirrors.txt && cat /etc/apt/apt-mirrors.txt
145+
echo -------------
146+
echo /etc/apt/sources.list.d/ports.list && cat /etc/apt/sources.list.d/ports.list || true
147+
echo -------------
148+
149+
sudo dpkg --add-architecture arm64
150+
sudo apt update
151+
152+
sudo apt install -y \
153+
gcc-multilib \
154+
g++-multilib
155+
156+
echo -------------
157+
echo install arm64 dependences ...
158+
159+
sudo apt install -y \
160+
gcc-aarch64-linux-gnu \
161+
g++-aarch64-linux-gnu \
162+
libc6-dev-arm64-cross \
163+
libgtk-3-dev \
164+
patchelf:arm64 \
165+
libwebkit2gtk-4.1-dev:arm64 \
166+
libappindicator3-dev:arm64 \
167+
libssl-dev:arm64 \
168+
libssl3:arm64 \
169+
libgtk-3-dev:arm64 \
170+
librsvg2-dev:arm64
171+
172+
echo 'ok'
173+
174+
- name: Build for Linux
175+
run: |
176+
echo "build native binarys..."
177+
178+
export PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig/:$PKG_CONFIG_PATH
179+
export PKG_CONFIG_SYSROOT_DIR=/usr/aarch64-linux-gnu/
180+
export PKG_CONFIG_ALLOW_CROSS=1
181+
pnpm build --target aarch64-unknown-linux-gnu
182+
183+
echo "build native binarys finished"
184+
env:
185+
NODE_OPTIONS: '--max_old_space_size=4096'
186+
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
187+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
188+
189+
- name: Get Version
190+
run: |
191+
sudo apt-get update
192+
sudo apt-get install jq
193+
echo "VERSION=$(cat package.json | jq '.version' | tr -d '"')" >> $GITHUB_ENV
194+
195+
- name: Upload Release
196+
uses: softprops/action-gh-release@v2
197+
with:
198+
tag_name: v${{env.VERSION}}-alpha
199+
name: 'NVM Desktop v${{env.VERSION}}-alpha'
200+
body: 'More new features are now supported.'
201+
draft: false
202+
prerelease: true
203+
token: ${{ secrets.GITHUB_TOKEN }}
204+
files: |
205+
src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
206+
src-tauri/target/${{ matrix.target }}/release/bundle/rpm/*.rpm
207+
208+
alpha-for-fixed-webview2:
209+
strategy:
210+
fail-fast: false
211+
matrix:
212+
include:
213+
- os: windows-latest
214+
target: x86_64-pc-windows-msvc
215+
arch: x64
216+
- os: windows-latest
217+
target: aarch64-pc-windows-msvc
218+
arch: arm64
219+
runs-on: ${{ matrix.os }}
220+
steps:
221+
- name: Checkout Repository
222+
uses: actions/checkout@v4
223+
224+
- name: Add Rust Target
225+
run: rustup target add ${{ matrix.target }}
226+
227+
- name: Rust Cache
228+
uses: Swatinem/rust-cache@v2
229+
with:
230+
workspaces: src-tauri
231+
232+
- name: Install Node
233+
uses: actions/setup-node@v4
234+
with:
235+
node-version: '20'
236+
237+
- uses: pnpm/action-setup@v4
238+
name: Install pnpm
239+
with:
240+
run_install: false
241+
242+
- name: Pnpm install and check
243+
run: |
244+
pnpm i
245+
pnpm check ${{ matrix.target }}
246+
247+
- name: Download WebView2 Runtime
248+
run: |
249+
invoke-webrequest -uri https://github.com/westinyang/WebView2RuntimeArchive/releases/download/127.0.2651.105/Microsoft.WebView2.FixedVersionRuntime.127.0.2651.105.${{ matrix.arch }}.cab -outfile Microsoft.WebView2.FixedVersionRuntime.127.0.2651.105.${{ matrix.arch }}.cab
250+
Expand .\Microsoft.WebView2.FixedVersionRuntime.127.0.2651.105.${{ matrix.arch }}.cab -F:* ./src-tauri
251+
Remove-Item .\src-tauri\tauri.windows.conf.json
252+
Rename-Item .\src-tauri\webview2.${{ matrix.arch }}.json tauri.windows.conf.json
253+
254+
- name: Tauri build
255+
id: build
256+
uses: tauri-apps/tauri-action@v0
257+
env:
258+
NODE_OPTIONS: '--max_old_space_size=4096'
259+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
260+
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
261+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
262+
with:
263+
tauriScript: pnpm
264+
args: --target ${{ matrix.target }}
265+
266+
- name: Rename
267+
run: |
268+
Rename-Item '.\src-tauri\target\${{ matrix.target }}\release\bundle\nsis\NVM Desktop_${{steps.build.outputs.appVersion}}_${{ matrix.arch }}-setup.exe' 'NVM Desktop_${{steps.build.outputs.appVersion}}_${{ matrix.arch }}_fixed_webview2-setup.exe'
269+
Rename-Item '.\src-tauri\target\${{ matrix.target }}\release\bundle\nsis\NVM Desktop_${{steps.build.outputs.appVersion}}_${{ matrix.arch }}-setup.exe.sig' 'NVM Desktop_${{steps.build.outputs.appVersion}}_${{ matrix.arch }}_fixed_webview2-setup.exe.sig'
270+
271+
- name: Upload Release
272+
uses: softprops/action-gh-release@v2
273+
with:
274+
tag_name: v${{steps.build.outputs.appVersion}}-alpha
275+
name: 'NVM Desktop v${{steps.build.outputs.appVersion}}-alpha'
276+
body: 'More new features are now supported.'
277+
draft: false
278+
prerelease: true
279+
token: ${{ secrets.GITHUB_TOKEN }}
280+
files: src-tauri/target/${{ matrix.target }}/release/bundle/nsis/*setup*
281+
282+
update_alpha_notes:
283+
name: Update alpha notes
284+
runs-on: ubuntu-latest
285+
needs: [alpha, alpha-for-linux-arm64, alpha-for-fixed-webview2]
286+
steps:
287+
- name: Checkout repository
288+
uses: actions/checkout@v4
289+
290+
- name: Set Env
291+
run: |
292+
echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
293+
shell: bash
294+
295+
- name: Get Version
296+
run: |
297+
sudo apt-get update
298+
sudo apt-get install jq
299+
echo "VERSION=$(cat package.json | jq '.version' | tr -d '"')" >> $GITHUB_ENV
300+
301+
- name: Update Tag
302+
uses: richardsimko/update-tag@v1
303+
with:
304+
tag_name: v${{ env.VERSION }}-alpha
305+
env:
306+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
307+
308+
- run: |
309+
cat > release.txt << 'EOF'
310+
## Which version should I download?
311+
312+
### MacOS (Prompts that the file is damaged or the developer cannot verify it. Please check [MacOS issues](https://github.com/1111mp/nvm-desktop?tab=readme-ov-file#macos-issues))
313+
- MacOS Intel chip: x64.dmg
314+
- MacOS apple M chip: aarch64.dmg
315+
316+
### Linux
317+
- Linux 64-bit: amd64.deb/amd64.rpm
318+
- Linux arm64 architecture: arm64.deb/aarch64.rpm
319+
320+
### Windows (Win7 users please make sure to install and enable webview2)
321+
#### Normal version (recommended)
322+
- 64-bit: x64-setup.exe
323+
- arm64 architecture: arm64-setup.exe
324+
#### Built-in Webview2 version (large in size, only used when the enterprise version system or Win7 cannot install webview2)
325+
- 64-bit: x64_fixed_webview2-setup.exe
326+
- arm64 architecture: arm64_fixed_webview2-setup.exe
327+
328+
---
329+
330+
## 我应该下载哪个版本?
331+
332+
### MacOS (提示文件损坏或开发者无法验证请查看 [MacOS issues](https://github.com/1111mp/nvm-desktop?tab=readme-ov-file#macos-issues))
333+
- MacOS intel芯片: x64.dmg
334+
- MacOS apple M芯片: aarch64.dmg
335+
336+
### Linux
337+
- Linux 64位: amd64.deb/amd64.rpm
338+
- Linux arm64架构: arm64.deb/aarch64.rpm
339+
340+
### Windows (Win7 用户请确保安装并启用webview2)
341+
#### 正常版本(推荐)
342+
- 64位: x64-setup.exe
343+
- arm64架构: arm64-setup.exe
344+
#### 内置Webview2版(体积较大,仅在企业版系统或Win7无法安装webview2时使用)
345+
- 64位: x64_fixed_webview2-setup.exe
346+
- arm64架构: arm64_fixed_webview2-setup.exe
347+
348+
Created at ${{ env.BUILDTIME }}.
349+
EOF
350+
351+
- name: Upload Release
352+
uses: softprops/action-gh-release@v2
353+
with:
354+
tag_name: v${{ env.VERSION }}-alpha
355+
name: 'NVM Desktop v${{env.VERSION}}-alpha'
356+
body_path: release.txt
357+
draft: false
358+
prerelease: true
359+
token: ${{ secrets.GITHUB_TOKEN }}
360+
generate_release_notes: true

@types/index.d.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,15 @@ declare global {
9494

9595
interface ConfigrationExport {
9696
color?: string;
97-
mirrors?: string | null;
98-
path: string;
97+
mirrors?: string;
9998
projects?: boolean;
10099
setting?: boolean;
101100
}
102101

103-
interface Configration {
102+
interface ConfigrationImport {
104103
color?: string;
105104
mirrors?: string;
106105
setting?: Setting;
107-
projects?: Project[];
108-
groups?: Group[];
109106
}
110107
}
111108
}

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"build:verbose": "tauri build --verbose",
1010
"tauri": "tauri",
1111
"ui:dev": "vite",
12-
"ui:build": "vite build",
12+
"ui:build": "tsc && vite build",
1313
"ui:preview": "vite preview",
1414
"check": "node scripts/check.mjs",
1515
"updater": "node scripts/updater.mjs",
@@ -84,5 +84,5 @@
8484
"typescript": "^5.5.4",
8585
"vite": "^5.4.2"
8686
},
87-
"packageManager": "pnpm@9.7.0"
88-
}
87+
"packageManager": "pnpm@9.9.0"
88+
}

0 commit comments

Comments
 (0)