Skip to content

Commit c2e9e62

Browse files
CC11001100claude
andcommitted
Add GitHub Pages deployment workflow and fix subpath config
- Add .github/workflows/deploy.yml (GitHub Pages, npm ci + vite build) - Set vite base to /leetcode-53-maximum-subarray/ for subpath deployment - Replace missing vite.svg favicon with inline emoji data URI - Add online demo link to README - Add server-url.txt to .gitignore (internal LAN address, not committed) Co-Authored-By: Claude Code <noreply@anthropic.com>
1 parent 25780c5 commit c2e9e62

6 files changed

Lines changed: 64 additions & 7 deletions

File tree

‎.github/workflows/deploy.yml‎

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

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ dist
1212
dist-ssr
1313
*.local
1414

15+
# 局域网访问入口(内网地址不入库)
16+
server-url.txt
17+
1518
# Editor directories and files
1619
.vscode/*
1720
!.vscode/extensions.json

‎README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
一个交互式的可视化应用,帮助你理解 LeetCode 53 题的最大子数组和算法(Kadane's Algorithm)。
44

5+
## 🎉 在线演示
6+
7+
👉 [点击查看在线演示](https://fuck-algorithm.github.io/leetcode-53-maximum-subarray/)
8+
59
## 📚 算法简介
610

711
**Kadane 算法**是一个经典的动态规划算法,用于在 O(n) 时间复杂度内找到一个数组中具有最大和的连续子数组。

‎index.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="zh-CN">
33
<head>
44
<meta charset="UTF-8" />
5-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
5+
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🎯</text></svg>" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<title>最大子数组和 - 算法可视化</title>
88
</head>

‎package-lock.json‎

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

‎vite.config.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import react from '@vitejs/plugin-react'
33

44
export default defineConfig({
55
plugins: [react()],
6+
// GitHub Pages 部署在子路径下,需要配置 base
7+
base: '/leetcode-53-maximum-subarray/',
68
server: {
79
port: 60740,
810
},

0 commit comments

Comments
 (0)