Skip to content

Commit c631e4b

Browse files
committed
Unify packager config in Cargo metadata
1 parent 8aaac67 commit c631e4b

6 files changed

Lines changed: 54 additions & 47 deletions

File tree

.github/workflows/build-release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@ jobs:
1717
include:
1818
- os: ubuntu-latest
1919
artifact_name: linux-x64
20-
package_cmd: cargo packager -f deb -c Packager.toml
20+
package_cmd: cargo packager -f deb
2121
- os: ubuntu-24.04-arm
2222
artifact_name: linux-arm64
23-
package_cmd: cargo packager -f deb -c Packager.toml
23+
package_cmd: cargo packager -f deb
2424
- os: windows-latest
2525
artifact_name: windows-x64
26-
package_cmd: cargo packager -f nsis -c Packager.toml
26+
package_cmd: cargo packager -f nsis
2727
- os: windows-11-arm
2828
artifact_name: windows-arm64
29-
package_cmd: cargo packager -f nsis -c Packager.toml
29+
package_cmd: cargo packager -f nsis
3030
- os: macos-15
3131
artifact_name: macos-arm64
32-
package_cmd: cargo packager -f dmg -c Packager.toml
32+
package_cmd: cargo packager -f dmg
3333
- os: macos-15-intel
3434
artifact_name: macos-intel
35-
package_cmd: cargo packager -f dmg -c Packager.toml
35+
package_cmd: cargo packager -f dmg
3636

3737
runs-on: ${{ matrix.os }}
3838
name: Build ${{ matrix.artifact_name }}

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,47 @@
11
[package]
22
name = "linuxdo-accelerator"
3-
version = "0.1.11"
3+
version = "0.1.12"
44
edition = "2024"
55
build = "build.rs"
66
authors = ["fjh1997 <549308442@qq.com>"]
77
license = "MIT"
88
description = "Native Rust linux.do accelerator with CLI and desktop shell"
99

10+
[package.metadata.packager]
11+
product-name = "Linux.do Accelerator"
12+
identifier = "io.linuxdo.accelerator"
13+
out-dir = "./dist"
14+
binaries-dir = "./target/release"
15+
formats = ["deb", "dmg", "nsis"]
16+
before-packaging-command = "cargo build --release --bin linuxdo-accelerator"
17+
publisher = "linux.do"
18+
description = "Native Rust linux.do accelerator desktop app"
19+
long-description = """
20+
A native Rust linux.do accelerator with one unified executable.
21+
The same binary supports desktop GUI and CLI modes depending on the command-line arguments.
22+
"""
23+
category = "DeveloperTool"
24+
icons = ["assets/icons/linuxdo.ico", "assets/icons/*.png"]
25+
26+
[[package.metadata.packager.binaries]]
27+
path = "linuxdo-accelerator"
28+
main = true
29+
30+
[package.metadata.packager.linux]
31+
generate-desktop-entry = true
32+
33+
[package.metadata.packager.macos]
34+
signing-identity = "-"
35+
36+
[package.metadata.packager.deb]
37+
section = "utils"
38+
package-name = "linuxdo-accelerator"
39+
desktop-template = "packaging/linux/linuxdo-accelerator.desktop.hbs"
40+
41+
[package.metadata.packager.nsis]
42+
installer-mode = "perMachine"
43+
installer-icon = "assets/icons/linuxdo.ico"
44+
1045
[dependencies]
1146
anyhow = "1"
1247
bytes = "1"

Packager.toml

Lines changed: 0 additions & 36 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ Android 版当前单独打包为 APK:
199199

200200
## Packaging
201201

202-
项目使用 [`cargo-packager`](https://github.com/crabnebula-dev/cargo-packager)[`Packager.toml`](./Packager.toml)
202+
项目使用 [`cargo-packager`](https://github.com/crabnebula-dev/cargo-packager),打包配置直接写在 [`Cargo.toml`](./Cargo.toml)`[package.metadata.packager]`
203203

204204
- Windows:`NSIS .exe`,同时输出 `x64``arm64` 两个变体
205205
- Linux:`.deb`,同时输出 `amd64``arm64` 两个变体
@@ -210,13 +210,13 @@ Android 版当前单独打包为 APK:
210210

211211
```bash
212212
cargo install cargo-packager --locked
213-
cargo packager --release -c Packager.toml
213+
cargo packager --release
214214
```
215215

216216
只打 Linux `deb`
217217

218218
```bash
219-
cargo packager -f deb --release -c Packager.toml
219+
cargo packager -f deb --release
220220
```
221221

222222
macOS 安装提示:

src/gui.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ use crate::state::ServiceState;
3535

3636
const APP_WINDOW_TITLE: &str = "Linux.do Accelerator";
3737
const APP_ID: &str = "linuxdo-accelerator";
38+
const APP_VERSION: &str = env!("CARGO_PKG_VERSION");
3839

3940
pub fn run(config_path: PathBuf) -> Result<()> {
4041
let native_options = eframe::NativeOptions {
@@ -525,6 +526,12 @@ impl eframe::App for AcceleratorApp {
525526
.color(egui::Color32::from_rgb(247, 247, 243)),
526527
);
527528
ui.add_space(6.0);
529+
ui.label(
530+
RichText::new(format!("v{APP_VERSION}"))
531+
.font(FontId::proportional(11.5))
532+
.color(egui::Color32::from_rgb(157, 168, 177)),
533+
);
534+
ui.add_space(6.0);
528535
egui::Frame::new()
529536
.fill(accent.linear_multiply(0.18))
530537
.stroke(egui::Stroke::new(1.0, accent.linear_multiply(0.75)))
@@ -786,6 +793,7 @@ impl eframe::App for AcceleratorApp {
786793
egui::ScrollArea::vertical().show(ui, |ui| {
787794
ui.add(egui::Image::new((self.logo.id(), egui::vec2(42.0, 42.0))));
788795
ui.label(RichText::new("Linux.do Accelerator").strong());
796+
ui.label(format!("版本 v{APP_VERSION}"));
789797
ui.label("原生 Rust 桌面壳 + CLI");
790798
ui.label("支持证书安装、hosts 接管和本地 80/443 监听");
791799
ui.label("DoH 与子域支持列表统一放在 linuxdo-accelerator.toml");

0 commit comments

Comments
 (0)