Skip to content

Commit 656844e

Browse files
init
0 parents  commit 656844e

34 files changed

Lines changed: 7238 additions & 0 deletions

.github/workflows/deploy.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# 构建 VitePress 站点并将其部署到 GitHub Pages 的工作流程
2+
name: Deploy VitePress site to Pages
3+
4+
on: # 定义触发条件
5+
push: # 当代码推送到仓库时触发
6+
branches: [main] # 仅在 main 分支推送时触发
7+
workflow_dispatch: # 允许从 Actions 选项卡手动触发
8+
9+
permissions: # 设置 GITHUB_TOKEN 的权限
10+
contents: read # 读取仓库内容的权限
11+
pages: write # 写入 GitHub Pages 的权限
12+
id-token: write # OIDC 身份验证令牌的写入权限
13+
14+
concurrency: # 并发控制,避免同一组同时运行多个部署
15+
group: pages # 将并发任务归为 "pages" 组
16+
cancel-in-progress: false # 不取消正在运行的部署,允许其完成
17+
18+
jobs: # 定义工作流中的作业
19+
build: # 构建作业
20+
runs-on: ubuntu-latest # 运行在最新的 Ubuntu 虚拟环境上
21+
steps: # 构建作业的步骤序列
22+
- name: Checkout # 步骤1:检出代码
23+
uses: actions/checkout@v5 # 使用官方的 checkout action v5
24+
with:
25+
fetch-depth: 0 # 获取完整的 git 历史记录
26+
27+
- name: Setup Node # 步骤2:设置 Node.js 环境
28+
uses: actions/setup-node@v6 # 使用官方的 setup-node action v6
29+
with:
30+
node-version: 24 # 指定 Node.js 版本为 24
31+
cache: npm # 缓存 npm 依赖以加快后续构建
32+
33+
- name: Setup Pages # 步骤3:配置 GitHub Pages
34+
uses: actions/configure-pages@v4 # 自动注入 base path 等 Pages 配置
35+
36+
- name: Install dependencies # 步骤4:安装项目依赖
37+
run: npm ci # 使用 ci 命令严格按 lock 文件安装
38+
39+
- name: Build with VitePress # 步骤5:构建静态站点
40+
run: npm run www:build # 执行 vitepress build 命令
41+
42+
- name: Upload artifact # 步骤6:上传构建产物
43+
uses: actions/upload-pages-artifact@v3 # 使用官方的上传 artifact action
44+
with:
45+
path: dist # 指定构建输出目录(对应 VitePress 的 outDir)
46+
47+
deploy: # 部署作业
48+
environment: # 部署环境配置
49+
name: github-pages # 环境名称为 github-pages
50+
url: ${{ steps.deployment.outputs.page_url }} # 动态获取部署后的页面 URL
51+
needs: build # 依赖 build 作业,必须先完成构建
52+
runs-on: ubuntu-latest # 运行在最新的 Ubuntu 虚拟环境上
53+
name: Deploy # 作业显示名称
54+
steps: # 部署作业的步骤序列
55+
- name: Deploy to GitHub Pages # 步骤1:部署到 GitHub Pages
56+
id: deployment # 步骤 ID,用于引用输出结果
57+
uses: actions/deploy-pages@v4 # 使用官方的部署 action v4

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.obsidian/
2+
.tmp/
3+
.vitepress/cache/
4+
5+
dist/
6+
node_modules/

.vitepress/config.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { defineConfig } from 'vitepress'
2+
3+
export default defineConfig({
4+
vite: {
5+
server: {
6+
host: '0.0.0.0'
7+
},
8+
optimizeDeps: {
9+
exclude: ['lucide']
10+
}
11+
},
12+
base: '/',
13+
title: "技术博客",
14+
description: "Technical blog and documentation",
15+
srcDir: 'www',
16+
outDir: 'dist',
17+
head: [
18+
['link', { rel: 'icon', type: 'image/svg+xml', href: '/favicon.svg' }]
19+
],
20+
21+
themeConfig: {
22+
search: {
23+
provider: 'local'
24+
},
25+
26+
nav: [
27+
{ text: '主页', link: '/' },
28+
{
29+
text: '更多',
30+
items: [
31+
{ text: '文章博客', link: '/blog/' },
32+
{ text: '主题专栏', link: '/topics/' },
33+
{ text: '个人Wiki', link: '/wiki/' },
34+
{ text: '个人笔记', link: '/notes/' },
35+
{ text: '个人日志', link: '/logs/' },
36+
{ text: '相关资源', link: '/resources/' },
37+
{ text: '简历', link: '/resume' },
38+
{ text: '工作台', link: '/workspace' },
39+
{ text: '实验室', link: '/runtime-api' },
40+
{ text: '更新日志', link: '/changelog' }
41+
]
42+
},
43+
{ text: '标签', link: '/tags' },
44+
{ text: '关于', link: '/about' }
45+
],
46+
socialLinks: [
47+
{ icon: 'github', link: 'https://github.com/ambiguous-pointer' }
48+
]
49+
},
50+
51+
markdown: {
52+
theme: 'github-dark',
53+
lineNumbers: true
54+
}
55+
})

0 commit comments

Comments
 (0)