Skip to content

Commit 232e145

Browse files
committed
auto update
1 parent 4241fd6 commit 232e145

8 files changed

Lines changed: 403 additions & 18 deletions

File tree

.github/workflows/build.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- dev
9+
tags:
10+
- 'v*'
11+
12+
jobs:
13+
release:
14+
runs-on: ${{ matrix.os }}
15+
16+
strategy:
17+
matrix:
18+
os: [windows-latest]
19+
20+
steps:
21+
- name: Check out Git repository
22+
uses: actions/checkout@v3
23+
24+
- name: Install Node.js
25+
uses: actions/setup-node@v3
26+
with:
27+
node-version: 18
28+
29+
- name: Cache node modules
30+
uses: actions/cache@v3
31+
with:
32+
path: node_modules
33+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
34+
restore-keys: |
35+
${{ runner.os }}-node-
36+
37+
- name: Install Dependencies
38+
run: npm ci
39+
40+
- name: Build
41+
run: npm run build
42+
env:
43+
CI: false
44+
45+
- name: Prepare for Release
46+
run: |
47+
echo "APP_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
48+
shell: bash
49+
50+
- name: Build and Publish Electron App
51+
run: npm run publish
52+
env:
53+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
CI: false
55+
56+
- name: Upload Windows Artifacts
57+
if: matrix.os == 'windows-latest'
58+
uses: actions/upload-artifact@v3
59+
with:
60+
name: windows-artifacts
61+
path: release/LaTeX*.exe

README.md

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
- ⌨️ **全局快捷键** - 可自定义快捷键,支持后台运行
2424
- 🔑 **API配置** - 支持自定义[SimpleTex API](https://simpletex.cn/)配置
2525
- 🎨 **现代化界面** - 基于 Styled Components 的美观界面设计
26+
- 🔄 **自动更新** - 支持检测和安装新版本,无需手动下载
2627

2728
## 🛠️ 技术栈
2829

@@ -32,9 +33,14 @@
3233
- **状态管理**: React Hooks
3334
- **API服务**: SimpleTex OCR API
3435
- **构建工具**: Create React App + Electron Builder
36+
- **自动更新**: electron-updater
3537

3638
## 📦 安装和运行
3739

40+
### 安装包下载
41+
42+
访问 [Release 页面](https://github.com/你的GitHub用户名/SimpleTex-OCR/releases) 下载最新版安装包
43+
3844
### 环境要求
3945

4046
- Node.js 16+
@@ -91,6 +97,12 @@
9197
npm run dist
9298
```
9399

100+
4. **生成安装包并发布到GitHub**
101+
```bash
102+
npm run publish
103+
```
104+
这会构建应用并将其发布到GitHub Releases,触发自动更新。
105+
94106
## 🚀 快速使用
95107

96108
### 基本操作
@@ -122,6 +134,14 @@
122134
- 点击菜单"历史记录"查看识别历史
123135
- 可以重新使用或删除历史记录
124136

137+
### 自动更新
138+
139+
应用支持自动更新功能,当有新版本发布时:
140+
141+
1. 应用启动后会自动检查更新
142+
2. 如果发现新版本,会提示用户下载
143+
3. 下载完成后,可选择立即重启应用安装新版本或稍后安装
144+
125145
## 📁 项目结构
126146

127147
```
@@ -156,6 +176,7 @@ src/
156176
"axios": "^1.5.0",
157177
"crypto-js": "^4.1.1",
158178
"electron-store": "^8.1.0",
179+
"electron-updater": "^6.6.2",
159180
"react-dropzone": "^14.2.3"
160181
}
161182
```
@@ -165,13 +186,14 @@ src/
165186
- **React 应用**: 使用 Create React App 构建
166187
- **Electron 主进程**: 使用 TypeScript 编译到 `dist/` 目录
167188
- **打包**: 使用 Electron Builder 生成各平台安装包
189+
- **自动更新**: 使用 electron-updater 实现自动检测和安装更新
168190

169-
### API 集成
191+
### 持续集成
170192

171-
应用使用 SimpleTex API 进行公式识别:
172-
- API 地址: `https://server.simpletex.cn/api/latex_ocr`
173-
- 支持多种图片格式: PNG, JPG, JPEG, BMP, GIF
174-
- 自动处理签名和请求头
193+
项目配置了GitHub Actions进行自动构建和发布:
194+
- 当推送到主分支或有新标签时,自动触发构建
195+
- 构建完成后自动发布到GitHub Releases
196+
- 已安装的应用会自动检测到新版本
175197

176198
## 🔒 安全性
177199

@@ -181,7 +203,12 @@ src/
181203

182204
## 📝 更新日志
183205

184-
### v3.0.0 - TypeScript版本
206+
### v3.7.0
207+
- ✨ 添加安装包形式发布
208+
- 🔄 支持自动检测和安装更新
209+
- 🛠️ 优化应用启动和运行性能
210+
211+
### v3.6.2
185212
- 🚀 全新的 TypeScript + React + Electron 架构
186213
- 🎨 现代化的界面设计和用户体验
187214
- 📱 更好的响应式布局和交互

assets/icon.ico

19.8 KB
Binary file not shown.

package-lock.json

Lines changed: 98 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)