Skip to content

Commit 29a3763

Browse files
committed
feat(website): 官网建立与部署流水线(Tauri 版产品信息适配)
1 parent 5a66a50 commit 29a3763

61 files changed

Lines changed: 11002 additions & 2 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Deploy Website
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths: ['website/**']
7+
# 手动触发入口:用于部署链路验证与紧急重部署(不依赖路径变更)
8+
workflow_dispatch:
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 30
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: 22
20+
cache: 'npm'
21+
cache-dependency-path: website/package-lock.json
22+
23+
- name: Install dependencies and build
24+
env:
25+
# 下载源基址:配置了 CDN 后填入该 Secret(如 https://dl.entropydecrease.com);
26+
# 未配置时为空字符串,前端自动回退至自建服务器
27+
NEXT_PUBLIC_DOWNLOAD_BASE: ${{ secrets.DOWNLOAD_BASE_URL }}
28+
run: |
29+
cd website
30+
npm ci
31+
npm run build
32+
33+
- name: Ensure target directory exists
34+
uses: appleboy/ssh-action@v1
35+
with:
36+
host: ${{ secrets.SERVER_HOST }}
37+
username: ${{ secrets.SERVER_USER }}
38+
key: ${{ secrets.SSH_PRIVATE_KEY }}
39+
script: mkdir -p /opt/Entropydecrease/website
40+
41+
- name: Upload static files to server
42+
uses: appleboy/scp-action@v0.1.7
43+
with:
44+
host: ${{ secrets.SERVER_HOST }}
45+
username: ${{ secrets.SERVER_USER }}
46+
key: ${{ secrets.SSH_PRIVATE_KEY }}
47+
source: website/out/*
48+
target: /opt/Entropydecrease/website
49+
strip_components: 2
50+
rm: true
51+
52+
- name: Restart Nginx and verify deployment
53+
uses: appleboy/ssh-action@v1
54+
with:
55+
host: ${{ secrets.SERVER_HOST }}
56+
username: ${{ secrets.SERVER_USER }}
57+
key: ${{ secrets.SSH_PRIVATE_KEY }}
58+
script: |
59+
# scp 的 rm:true 会重建挂载目录导致 bind mount 失效,必须重启容器
60+
docker restart entropy-decrease-nginx
61+
sleep 5
62+
curl -sf https://entropydecrease.com/ | grep -q "熵减" || exit 1
63+
64+
- name: Notify IndexNow
65+
run: |
66+
curl -sf -X POST "https://api.indexnow.org/indexnow" \
67+
-H "Content-Type: application/json; charset=utf-8" \
68+
-d '{
69+
"host": "entropydecrease.com",
70+
"key": "2483a0d298b94b62a30be65fce88940e",
71+
"keyLocation": "https://entropydecrease.com/2483a0d298b94b62a30be65fce88940e.txt",
72+
"urlList": [
73+
"https://entropydecrease.com/",
74+
"https://entropydecrease.com/download",
75+
"https://entropydecrease.com/philosophy",
76+
"https://entropydecrease.com/features",
77+
"https://entropydecrease.com/features/dive",
78+
"https://entropydecrease.com/support",
79+
"https://entropydecrease.com/faq"
80+
]
81+
}' || echo "IndexNow notify failed (non-blocking)"

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
app-frontend: ${{ steps.filter.outputs.app-frontend }}
2121
app-rust: ${{ steps.filter.outputs.app-rust }}
2222
docs: ${{ steps.filter.outputs.docs }}
23+
website: ${{ steps.filter.outputs.website }}
2324
steps:
2425
- uses: actions/checkout@v4
2526
- uses: dorny/paths-filter@v3
@@ -40,6 +41,8 @@ jobs:
4041
- 'docs/**'
4142
- 'scripts/docs-check.mjs'
4243
- '.docscheckignore'
44+
website:
45+
- 'website/**'
4346
4447
# ===========================================================================
4548
# App 前端 —— React + Vite + TypeScript
@@ -85,6 +88,25 @@ jobs:
8588
- name: Lint (clippy)
8689
run: cd app/src-tauri && cargo clippy -- -D warnings
8790

91+
# ===========================================================================
92+
# 官网 —— Next.js 静态站(构建验证,部署走 deploy-website.yml)
93+
# ===========================================================================
94+
website:
95+
needs: changes
96+
if: needs.changes.outputs.website == 'true'
97+
runs-on: ubuntu-latest
98+
timeout-minutes: 15
99+
steps:
100+
- uses: actions/checkout@v4
101+
- uses: actions/setup-node@v4
102+
with:
103+
node-version: 22
104+
cache: 'npm'
105+
cache-dependency-path: website/package-lock.json
106+
- run: cd website && npm ci
107+
- name: Build
108+
run: cd website && npm run build
109+
88110
# ===========================================================================
89111
# Docs —— 文档体系一致性检查(链接/索引/命名)
90112
# ===========================================================================

‎.releaserc.json‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@
6767
"assets": [
6868
"CHANGELOG.md",
6969
"app/package.json",
70-
"app/package-lock.json"
70+
"app/package-lock.json",
71+
"website/package.json",
72+
"website/package-lock.json"
7173
],
7274
"message": "chore(release): v${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
7375
}

‎scripts/version-bump.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..');
3737

3838
const projectDirs = (process.env.VERSION_SYNC_DIRS
3939
? process.env.VERSION_SYNC_DIRS.split(',')
40-
: ['app']
40+
: ['app', 'website']
4141
).map((s) => s.trim()).filter(Boolean);
4242

4343
/** 读取 JSON,交由 mutate 修改后写回,保留 2 空格缩进与末尾换行(npm 默认风格) */

‎website/.gitignore‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
12+
13+
# testing
14+
/coverage
15+
16+
# next.js
17+
/.next/
18+
/out/
19+
20+
# production
21+
/build
22+
23+
# misc
24+
.DS_Store
25+
*.pem
26+
27+
# debug
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
.pnpm-debug.log*
32+
33+
# env files (can opt-in for committing if needed)
34+
.env*
35+
36+
# vercel
37+
.vercel
38+
39+
# typescript
40+
*.tsbuildinfo
41+
next-env.d.ts

‎website/README.md‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
2+
3+
## Getting Started
4+
5+
First, run the development server:
6+
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
# or
12+
pnpm dev
13+
# or
14+
bun dev
15+
```
16+
17+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18+
19+
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20+
21+
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
22+
23+
## Learn More
24+
25+
To learn more about Next.js, take a look at the following resources:
26+
27+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29+
30+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
31+
32+
## Deploy on Vercel
33+
34+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35+
36+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.

0 commit comments

Comments
 (0)