Skip to content

Commit 40c8257

Browse files
authored
Merge pull request #1 from Aparencia/dev
feat: 熵减 Entropydecrease 品牌迁移与全仓规范化重构
2 parents 2ce52dc + 168e99e commit 40c8257

807 files changed

Lines changed: 142751 additions & 110159 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.env.example‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ===========================================
2-
# 课伴 (KeBan) MVP-2 Alpha 环境变量模板
2+
# 熵减 (Entropydecrease) 环境变量模板
33
# ===========================================
44
# 复制此文件为 .env 并填入实际值
55

@@ -54,10 +54,10 @@ AI_GATEWAY_PORT=8000
5454
# --- 生产部署配置 ---
5555

5656
# CORS 允许的前端域名(多个用逗号分隔)
57-
# CORS_ORIGINS=https://keban.app,https://www.keban.app
57+
# CORS_ORIGINS=https://entropydecrease.com,https://www.entropydecrease.com
5858

5959
# 前端 API 基础 URL(生产环境设置为后端服务域名)
60-
# VITE_API_BASE_URL=https://api.keban.app
60+
# VITE_API_BASE_URL=https://api.entropydecrease.com
6161

6262
# 日志级别(DEBUG/INFO/WARNING/ERROR)
6363
# LOG_LEVEL=INFO

‎.gitattributes‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
*.png filter=lfs diff=lfs merge=lfs -text
1+
*.png filter=lfs diff=lfs merge=lfs -text

‎.github/workflows/deploy-server.yml‎

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,56 @@ name: Deploy AI Gateway
22

33
on:
44
push:
5-
branches: [master]
5+
branches: [main]
66
paths: ['server/**']
77

88
jobs:
99
deploy:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
13-
- name: Build and push Docker image
14-
run: |
15-
cd server
16-
docker build -t ai-gateway:${{ github.sha }} .
17-
- name: Deploy to server
13+
14+
# 上传 server/ 源码到服务器(服务器非 git 仓库,代码由 CI 同步)
15+
# 注意:rm 必须为 false —— 服务器上的 .env.production 为真实生产密钥,
16+
# 不在仓库内(被 gitignore),删除目标目录会导致密钥永久丢失。
17+
- name: Upload server sources
18+
uses: appleboy/scp-action@v0.1.7
19+
with:
20+
host: ${{ secrets.SERVER_HOST }}
21+
username: ${{ secrets.SERVER_USER }}
22+
key: ${{ secrets.SSH_PRIVATE_KEY }}
23+
source: server/*
24+
target: /opt/Entropydecrease
25+
rm: false
26+
27+
- name: Rebuild and restart services
1828
uses: appleboy/ssh-action@v1
1929
with:
2030
host: ${{ secrets.SERVER_HOST }}
2131
username: ${{ secrets.SERVER_USER }}
2232
key: ${{ secrets.SSH_PRIVATE_KEY }}
2333
script: |
24-
cd /opt/keban
25-
docker-compose pull
26-
docker-compose up -d --force-recreate
27-
sleep 10
28-
curl -f http://localhost:8000/health || (docker-compose rollback && exit 1)
34+
set -e
35+
cd /opt/Entropydecrease/server
36+
37+
# .env.production 含生产密钥,必须显式传入,否则 DB_PASSWORD 等会被解析为空串
38+
COMPOSE="docker compose -f docker-compose.prod.yml --env-file .env.production"
39+
40+
# 拉取第三方镜像(postgres/redis/nginx),自建服务由 --build 重新构建
41+
$COMPOSE pull --ignore-buildable || true
42+
$COMPOSE up -d --build --force-recreate
43+
44+
# 健康检查:失败时输出日志便于定位(docker compose 无 rollback 子命令,
45+
# 回滚由 revert 提交重新触发部署完成)
46+
sleep 15
47+
if ! curl -fsS http://127.0.0.1:8000/health; then
48+
echo "::error::ai-gateway 健康检查失败,最近日志:"
49+
$COMPOSE logs --tail=60 ai-gateway
50+
exit 1
51+
fi
52+
if ! curl -fsS http://127.0.0.1:8080/health; then
53+
echo "::error::sync-service 健康检查失败,最近日志:"
54+
$COMPOSE logs --tail=60 sync-service
55+
exit 1
56+
fi
57+
echo "部署成功:ai-gateway 与 sync-service 健康检查通过"

‎.github/workflows/deploy-website.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Deploy Website
22

33
on:
44
push:
5-
branches: [master]
5+
branches: [main]
66
paths: ['website/**']
77

88
jobs:
@@ -29,7 +29,7 @@ jobs:
2929
host: ${{ secrets.SERVER_HOST }}
3030
username: ${{ secrets.SERVER_USER }}
3131
key: ${{ secrets.SSH_PRIVATE_KEY }}
32-
script: mkdir -p /opt/keban/website
32+
script: mkdir -p /opt/Entropydecrease/website
3333

3434
- name: Upload static files to server
3535
uses: appleboy/scp-action@v0.1.7
@@ -38,7 +38,7 @@ jobs:
3838
username: ${{ secrets.SERVER_USER }}
3939
key: ${{ secrets.SSH_PRIVATE_KEY }}
4040
source: website/out/*
41-
target: /opt/keban/website
41+
target: /opt/Entropydecrease/website
4242
strip_components: 2
4343
rm: true
4444

@@ -52,7 +52,7 @@ jobs:
5252
# scp 的 rm:true 会重建挂载目录导致 bind mount 失效,必须重启容器
5353
docker restart entropy-decrease-nginx
5454
sleep 5
55-
curl -sf https://entropydecrease.com/ | grep -q "课伴" || exit 1
55+
curl -sf https://entropydecrease.com/ | grep -q "熵减" || exit 1
5656
5757
- name: Notify IndexNow
5858
run: |

‎.github/workflows/pr-check.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: PR Quality Check
22

33
on:
44
pull_request:
5-
branches: [master]
5+
branches: [main, dev]
66

77
jobs:
88
# ===========================================================================

‎.github/workflows/release.yml‎

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
name: Release Electron App
2-
3-
# 由 semantic-release 创建的 v* tag 触发:构建 Electron 安装包并附加到对应 Release
4-
on:
5-
push:
6-
tags: ['v*']
7-
8-
# 上传构建产物到 GitHub Release 需要写权限
9-
permissions:
10-
contents: write
11-
12-
jobs:
13-
lint-test:
14-
runs-on: ubuntu-latest
15-
steps:
16-
- uses: actions/checkout@v4
17-
- uses: actions/setup-node@v4
18-
with:
19-
node-version: 20
20-
cache: 'npm'
21-
cache-dependency-path: client/package-lock.json
22-
- run: cd client && npm ci
23-
- run: cd client && npm run lint
24-
- run: cd client && npm run test -- --run
25-
26-
build:
27-
needs: lint-test
28-
strategy:
29-
matrix:
30-
os: [windows-latest, macos-latest]
31-
runs-on: ${{ matrix.os }}
32-
steps:
33-
- uses: actions/checkout@v4
34-
- uses: actions/setup-node@v4
35-
with:
36-
node-version: 20
37-
cache: 'npm'
38-
cache-dependency-path: client/package-lock.json
39-
- run: cd client && npm ci
40-
- run: cd client && npm run electron:build
41-
- uses: actions/upload-artifact@v4
42-
with:
43-
name: release-${{ matrix.os }}
44-
path: client/release/*.{exe,dmg,AppImage}
45-
46-
release:
47-
needs: build
48-
runs-on: ubuntu-latest
49-
steps:
50-
- uses: actions/download-artifact@v4
51-
with:
52-
pattern: release-*
53-
- uses: softprops/action-gh-release@v2
54-
with:
55-
files: release-*/*
1+
name: Release Electron App
2+
3+
# 由 semantic-release 创建的 v* tag 触发:构建 Electron 安装包并附加到对应 Release
4+
on:
5+
push:
6+
tags: ['v*']
7+
8+
# 上传构建产物到 GitHub Release 需要写权限
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
lint-test:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: 20
20+
cache: 'npm'
21+
cache-dependency-path: client/package-lock.json
22+
- run: cd client && npm ci
23+
- run: cd client && npm run lint
24+
- run: cd client && npm run test -- --run
25+
26+
build:
27+
needs: lint-test
28+
strategy:
29+
matrix:
30+
os: [windows-latest, macos-latest]
31+
runs-on: ${{ matrix.os }}
32+
steps:
33+
- uses: actions/checkout@v4
34+
- uses: actions/setup-node@v4
35+
with:
36+
node-version: 20
37+
cache: 'npm'
38+
cache-dependency-path: client/package-lock.json
39+
- run: cd client && npm ci
40+
- run: cd client && npm run electron:build
41+
- uses: actions/upload-artifact@v4
42+
with:
43+
name: release-${{ matrix.os }}
44+
path: client/release/*.{exe,dmg,AppImage}
45+
46+
release:
47+
needs: build
48+
runs-on: ubuntu-latest
49+
steps:
50+
- uses: actions/download-artifact@v4
51+
with:
52+
pattern: release-*
53+
- uses: softprops/action-gh-release@v2
54+
with:
55+
files: release-*/*

‎.github/workflows/version-release.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name: Version & Release
66
# 自动更新 package.json/package-lock.json、生成 CHANGELOG、创建 Git tag 与 GitHub Release。
77
on:
88
push:
9-
branches: [master]
9+
branches: [main]
1010

1111
# 同一分支串行执行,避免并发发布产生 tag/版本竞争
1212
concurrency:

‎.gitignore‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ Thumbs.db
3535
.env.local
3636
.env.*.local
3737
.env.production
38+
.env.test
3839

39-
# Documentation (local only, not version controlled)
40-
docs/
40+
# Brainstorm scratch (personal notes)
4141
brainstorm*.md
4242
ui_brainstorm.md
4343

‎.husky/commit-msg‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx --no -- commitlint --edit "$1"

‎.husky/pre-commit‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

0 commit comments

Comments
 (0)