Skip to content

Commit 9d72479

Browse files
committed
feat: 添加 GitHub Actions 自动部署到 GitHub Pages
- 创建 .github/workflows/deploy.yml 工作流配置 - 配置 Vite base 路径用于 GitHub Pages - 修复 TypeScript 配置兼容性问题 - 修复 ESLint 配置,添加 typescript-eslint 依赖 - 修复 Redux store 缺少 algorithm reducer 的问题 - 更新 AlgorithmStep 类型定义支持 state 属性
1 parent 5cda3f8 commit 9d72479

File tree

9 files changed

+445
-238
lines changed

9 files changed

+445
-238
lines changed

.github/workflows/deploy.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: pages
15+
cancel-in-progress: false
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: '20'
28+
cache: 'npm'
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Lint
34+
run: npm run lint
35+
36+
- name: Build
37+
run: npm run build
38+
39+
- name: Setup Pages
40+
uses: actions/configure-pages@v4
41+
42+
- name: Upload artifact
43+
uses: actions/upload-pages-artifact@v3
44+
with:
45+
path: ./dist
46+
47+
deploy:
48+
environment:
49+
name: github-pages
50+
url: ${{ steps.deployment.outputs.page_url }}
51+
runs-on: ubuntu-latest
52+
needs: build
53+
steps:
54+
- name: Deploy to GitHub Pages
55+
id: deployment
56+
uses: actions/deploy-pages@v4

eslint.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import reactRefresh from 'eslint-plugin-react-refresh'
55
import tseslint from 'typescript-eslint'
66

77
export default tseslint.config(
8-
{ ignores: ['dist'] },
8+
{ ignores: ['dist', 'leetcode-139-word-break'] },
99
{
1010
extends: [js.configs.recommended, ...tseslint.configs.recommended],
1111
files: ['**/*.{ts,tsx}'],
@@ -23,6 +23,11 @@ export default tseslint.config(
2323
'warn',
2424
{ allowConstantExport: true },
2525
],
26+
'@typescript-eslint/no-unused-vars': 'warn',
27+
'@typescript-eslint/no-explicit-any': 'warn',
28+
'@typescript-eslint/no-empty-object-type': 'warn',
29+
'no-case-declarations': 'warn',
30+
'prefer-const': 'warn',
2631
},
2732
},
2833
)

0 commit comments

Comments
 (0)