Skip to content

Commit 732b07d

Browse files
committed
docs: 添加 MIT 协议、重写 README 并纳入界面截图;CI: 移除 PyPI 发布、修复桌面端发布工作流
Made-with: Cursor
1 parent 4cd781c commit 732b07d

File tree

11 files changed

+184
-282
lines changed

11 files changed

+184
-282
lines changed

.github/workflows/build-desktop.yml

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Tauri 桌面端:多平台构建并发布到 GitHub Release
2-
# 触发:推送到 release 分支,或推送 tag desktop-v*
2+
# 触发:推送到 release 分支、推送 tag desktop-v*、或手动触发
33
name: Build and Release Desktop
44

55
on:
@@ -32,19 +32,65 @@ jobs:
3232
- name: Checkout
3333
uses: actions/checkout@v4
3434

35-
- name: Install dependencies (Ubuntu only)
36-
if: matrix.platform == 'ubuntu-22.04'
37-
run: |
38-
sudo apt-get update
39-
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
40-
4135
- name: Setup Node.js
4236
uses: actions/setup-node@v4
4337
with:
4438
node-version: 'lts/*'
4539
cache: 'npm'
4640
cache-dependency-path: desktop/package-lock.json
4741

42+
# 统一解析版本与发布 tag:tag 触发用 tag 版本,否则用 tauri 配置中的版本
43+
- name: Resolve version and release tag
44+
id: version
45+
run: |
46+
const ref = process.env.GITHUB_REF || '';
47+
const refName = process.env.GITHUB_REF_NAME || '';
48+
const fs = require('fs');
49+
const path = require('path');
50+
let version, releaseTag;
51+
if (ref.startsWith('refs/tags/') && refName.startsWith('desktop-v')) {
52+
version = refName.replace(/^desktop-v/, '');
53+
releaseTag = refName;
54+
} else {
55+
const confPath = path.join('desktop', 'src-tauri', 'tauri.conf.json');
56+
const conf = JSON.parse(fs.readFileSync(confPath, 'utf8'));
57+
version = conf.version;
58+
releaseTag = 'desktop-v' + version;
59+
}
60+
const out = process.env.GITHUB_OUTPUT;
61+
fs.appendFileSync(out, `version=${version}\nrelease_tag=${releaseTag}\n`);
62+
env:
63+
GITHUB_REF: ${{ github.ref }}
64+
GITHUB_REF_NAME: ${{ github.ref_name }}
65+
66+
# 从 tag 触发时,将版本写回项目配置,保证构建产物版本与 release 一致
67+
- name: Sync version to project (when triggered by tag)
68+
if: startsWith(github.ref, 'refs/tags/')
69+
run: |
70+
const fs = require('fs');
71+
const path = require('path');
72+
const v = process.env.VERSION;
73+
const confPath = path.join('desktop', 'src-tauri', 'tauri.conf.json');
74+
const conf = JSON.parse(fs.readFileSync(confPath, 'utf8'));
75+
conf.version = v;
76+
fs.writeFileSync(confPath, JSON.stringify(conf, null, 2));
77+
const cargoPath = path.join('desktop', 'src-tauri', 'Cargo.toml');
78+
let cargo = fs.readFileSync(cargoPath, 'utf8');
79+
cargo = cargo.replace(/^version = ".*"/m, `version = "${v}"`);
80+
fs.writeFileSync(cargoPath, cargo);
81+
const pkgPath = path.join('desktop', 'package.json');
82+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
83+
pkg.version = v;
84+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
85+
env:
86+
VERSION: ${{ steps.version.outputs.version }}
87+
88+
- name: Install dependencies (Ubuntu only)
89+
if: matrix.platform == 'ubuntu-22.04'
90+
run: |
91+
sudo apt-get update
92+
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
93+
4894
- name: Install Rust
4995
uses: dtolnay/rust-toolchain@stable
5096
with:
@@ -65,9 +111,10 @@ jobs:
65111
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66112
with:
67113
projectPath: desktop
68-
tagName: desktop-v__VERSION__
69-
releaseName: 'COMSOL Agent Desktop v__VERSION__'
70-
releaseBody: 'See the assets to download this version and install.'
114+
tagName: ${{ steps.version.outputs.release_tag }}
115+
releaseName: COMSOL Agent Desktop v${{ steps.version.outputs.version }}
116+
releaseBody: 'See the assets below to download and install.'
71117
releaseDraft: true
72118
prerelease: false
119+
appVersion: ${{ steps.version.outputs.version }}
73120
args: ${{ matrix.args }}

.github/workflows/publish-pypi.yml

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

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Mingjun Zhao
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)