Skip to content

Commit 3a1053a

Browse files
init
0 parents  commit 3a1053a

34 files changed

Lines changed: 7224 additions & 0 deletions

.github/workflows/deploy.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Deploy to GitHub Pages # 工作流的名字,显示在 GitHub Actions 界面中
2+
3+
on: # 定义触发条件
4+
push: # 当代码推送时触发
5+
branches: [main] # 仅在 master 分支推送时触发
6+
workflow_dispatch: # 允许手动触发工作流
7+
8+
permissions: # 设置工作流所需的权限
9+
contents: read # 读取仓库内容的权限
10+
pages: write # 写入 GitHub Pages 的权限
11+
id-token: write # 用于 OIDC 身份验证的权限
12+
13+
concurrency: # 并发控制,避免重复部署
14+
group: pages # 将同类任务归为 "pages" 组
15+
cancel-in-progress: false # 不取消正在运行的任务
16+
17+
jobs: # 定义工作流中的任务
18+
build: # 第一个任务:构建
19+
runs-on: ubuntu-latest # 在最新的 Ubuntu 环境中运行
20+
steps: # 构建任务的步骤
21+
- uses: actions/checkout@v4 # 第一步:检出仓库代码
22+
23+
- uses: actions/setup-node@v4 # 第二步:设置 Node.js 环境
24+
with:
25+
node-version: '24' # 使用 Node.js 24 版本
26+
cache: npm # 缓存 npm 依赖,加快构建速度
27+
28+
- run: npm ci # 第三步:安装依赖(ci 更严格,保证锁文件一致)
29+
- run: npm install && npm run www:build # 第四步:运行构建命令,生成静态网站文件
30+
31+
- uses: actions/upload-pages-artifact@v3 # 第五步:上传构建产物
32+
with:
33+
path: dist # 指定上传的目录(构建结果在 dist 文件夹)
34+
35+
deploy: # 第二个任务:部署
36+
needs: build # 依赖 build 任务,必须先完成构建
37+
runs-on: ubuntu-latest # 在最新的 Ubuntu 环境中运行
38+
environment: # 部署环境配置
39+
name: github-pages # 环境名称,GitHub Pages 专用
40+
url: ${{ steps.deployment.outputs.page_url }} # 部署完成后生成的页面 URL
41+
steps:
42+
- uses: actions/deploy-pages@v4 # 使用官方部署到 GitHub Pages 的 Action
43+
id: deployment # 给步骤一个 ID,方便引用输出结果

.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)