Skip to content

Commit 06e91d2

Browse files
committed
Add GitHub Pages deploy workflow
Update README with online demo and deployment instructions and improve quickstart layout Configure Vite base from VITE_BASE_PATH for correct Pages path Bump package version, add terser and upgrade vite Remove /test route and the API Test button from Settings
1 parent 140ce89 commit 06e91d2

7 files changed

Lines changed: 5265 additions & 34 deletions

File tree

‎.github/workflows/deploy.yml‎

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Build and Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
inputs:
12+
base_path:
13+
description: 'Base path for deployment (e.g., /chatlog-session/)'
14+
required: false
15+
default: ''
16+
17+
permissions:
18+
contents: read
19+
pages: write
20+
id-token: write
21+
22+
concurrency:
23+
group: "pages"
24+
cancel-in-progress: false
25+
26+
jobs:
27+
build:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
- name: Setup Node.js
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: '20'
37+
38+
- name: Cache dependencies
39+
uses: actions/cache@v3
40+
with:
41+
path: |
42+
~/.npm
43+
node_modules
44+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
45+
restore-keys: |
46+
${{ runner.os }}-npm-
47+
48+
- name: Install dependencies
49+
run: npm ci
50+
51+
- name: Build
52+
run: npm run build
53+
env:
54+
NODE_ENV: production
55+
VITE_BASE_PATH: ${{ github.event.inputs.base_path || '/chatlog-session/' }}
56+
57+
- name: Upload artifact
58+
uses: actions/upload-pages-artifact@v3
59+
with:
60+
path: ./dist
61+
62+
deploy:
63+
environment:
64+
name: github-pages
65+
url: ${{ steps.deployment.outputs.page_url }}
66+
runs-on: ubuntu-latest
67+
needs: build
68+
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
69+
steps:
70+
- name: Deploy to GitHub Pages
71+
id: deployment
72+
uses: actions/deploy-pages@v4

‎README.md‎

Lines changed: 70 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
一个现代化的 Web 应用,提供类似微信的界面来查看和管理您的聊天记录。
1414

15+
[在线演示](#-在线演示) •
1516
[功能特性](#-功能特性) •
1617
[快速开始](#-快速开始) •
1718
[技术栈](#️-技术栈) •
@@ -34,6 +35,32 @@ Chatlog Session 是一个基于 [Chatlog](https://github.com/sjzar/chatlog) API
3435
- 🔧 **灵活配置** - 可自定义 API 地址、超时、重试等参数
3536
- 🎯 **用户友好** - 自动初始化、智能后台加载、实时进度反馈
3637

38+
## 🌐 在线演示
39+
40+
### 体验地址
41+
42+
您可以直接访问在线演示版本,无需本地安装:
43+
44+
**🔗 https://xlight.github.io/chatlog-session/**
45+
46+
### 首次使用
47+
48+
1. 进入 **设置 → API 设定**
49+
2. 配置您的 Chatlog API 地址
50+
3. 点击 **测试连接** 验证
51+
4. 返回 **联系人** 视图,点击 **后台刷新** 加载数据
52+
53+
### 自动部署
54+
55+
本项目使用 GitHub Actions 自动构建和部署:
56+
57+
- ✅ 推送到 main 分支自动触发部署
58+
- ✅ 构建产物自动发布到 GitHub Pages
59+
- ✅ 支持手动触发部署
60+
- ✅ 每次部署约 2-3 分钟完成
61+
62+
详见:[GitHub Pages 部署指南](docs/deployment/github-pages.md)
63+
3764
## ✨ 功能特性
3865

3966
### 核心功能
@@ -81,12 +108,20 @@ Chatlog Session 是一个基于 [Chatlog](https://github.com/sjzar/chatlog) API
81108

82109
## 🚀 快速开始
83110

84-
### 前置要求
111+
### 方式 1: 在线体验(推荐)
112+
113+
直接访问在线演示:https://xlight.github.io/chatlog-session/
114+
115+
无需安装,只需配置 API 地址即可使用。
116+
117+
### 方式 2: 本地部署
118+
119+
#### 前置要求
85120

86121
1. ✅ [Node.js](https://nodejs.org/) >= 16.0.0
87122
2. ✅ [Chatlog](https://github.com/sjzar/chatlog) 已安装并运行
88123

89-
### 安装步骤
124+
#### 安装步骤
90125

91126
```bash
92127
# 克隆项目
@@ -102,7 +137,16 @@ npm run dev
102137

103138
### 配置 API
104139

105-
#### 方式 1: 环境变量(开发环境)
140+
#### 方式 1: 应用内设置(推荐)
141+
142+
1. 启动应用后,进入 **设置 → API 设定**
143+
2. 输入 Chatlog API 地址(如 `http://localhost:8080`)
144+
3. 点击 **测试连接** 验证
145+
4. 点击 **保存设置**
146+
147+
详见:[API 设定快速指南](docs/guides/quick-start/api-settings-quick-guide.md)
148+
149+
#### 方式 2: 环境变量(开发环境)
106150

107151
创建 `.env.local` 文件:
108152

@@ -112,16 +156,7 @@ VITE_API_TIMEOUT=30000
112156
VITE_ENABLE_DEBUG=true
113157
```
114158

115-
#### 方式 2: 应用内设置(推荐)
116-
117-
1. 启动应用后,进入 **设置 → API 设定**
118-
2. 输入 Chatlog API 地址(如 `http://localhost:8080`)
119-
3. 点击 **测试连接** 验证
120-
4. 点击 **保存设置**
121-
122-
详见:[API 设定快速指南](docs/guides/quick-start/api-settings-quick-guide.md)
123-
124-
### 启动 Chatlog API
159+
#### 启动 Chatlog API
125160

126161
```bash
127162
# 启动 Chatlog HTTP 服务
@@ -136,6 +171,10 @@ chatlog server --port 8080
136171
- [后台刷新指南](docs/guides/user/background-refresh-guide.md) - 如何刷新联系人数据
137172
- [API 设定指南](docs/guides/quick-start/api-settings-quick-guide.md) - 配置 API 连接
138173

174+
### 🚀 部署文档
175+
176+
- [GitHub Pages 部署](docs/deployment/github-pages.md) - 自动构建和发布到 GitHub Pages
177+
139178
### 💻 开发文档
140179

141180
- [开发者指南](docs/guides/developer/developer-guide.md) - 开发环境搭建
@@ -214,7 +253,6 @@ npm run type-check
214253

215254
# 代码检查和修复
216255
npm run lint
217-
npm run lint:fix
218256

219257
# 生产构建
220258
npm run build
@@ -285,6 +323,24 @@ npm run preview
285323
- ✅ 构建测试
286324
- ✅ 至少一位维护者的审查
287325

326+
## 🚢 部署
327+
328+
### GitHub Pages
329+
330+
本项目已配置 GitHub Actions 自动部署到 GitHub Pages:
331+
332+
1. 推送代码到 `main` 分支
333+
2. GitHub Actions 自动构建
334+
3. 自动部署到 `https://<username>.github.io/chatlog-session/`
335+
336+
详见:[GitHub Pages 部署指南](docs/deployment/github-pages.md)
337+
338+
### 其他部署方式
339+
340+
- **Vercel**: 导入 GitHub 仓库即可自动部署
341+
- **Netlify**: 拖拽 `dist` 目录或连接 Git 仓库
342+
- **自托管**: 构建后将 `dist` 目录部署到任意静态服务器
343+
288344
## 📋 路线图
289345

290346
### v0.5.0(计划中)

0 commit comments

Comments
 (0)