Skip to content

Commit 72800c9

Browse files
committed
CI/CD
1 parent 845ab49 commit 72800c9

File tree

12 files changed

+559
-143
lines changed

12 files changed

+559
-143
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: "22"
24+
cache: "yarn"
25+
26+
- name: Install dependencies
27+
run: yarn install --frozen-lockfile
28+
29+
- name: Type check
30+
run: yarn type-check
31+
32+
- name: Lint
33+
run: yarn lint
34+
35+
- name: Build
36+
run: yarn docs:build

.github/workflows/deploy.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# 部署到 GitHub Pages
2+
name: Deploy to GitHub Pages
3+
4+
on:
5+
# 仅手动触发
6+
workflow_dispatch:
7+
8+
# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
# 允许一个并发部署
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: true
18+
19+
jobs:
20+
deploy:
21+
environment:
22+
name: github-pages
23+
url: ${{ steps.deployment.outputs.page_url }}
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Setup Node.js
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: "22"
34+
cache: "yarn"
35+
36+
- name: Install dependencies
37+
run: yarn install --frozen-lockfile
38+
39+
- name: Type check
40+
run: yarn type-check
41+
42+
- name: Lint
43+
run: yarn lint
44+
45+
- name: Build
46+
run: yarn docs:build
47+
48+
- name: Setup Pages
49+
uses: actions/configure-pages@v5
50+
51+
- name: Upload artifact
52+
uses: actions/upload-pages-artifact@v3
53+
with:
54+
path: "./dist"
55+
56+
- name: Deploy to GitHub Pages
57+
id: deployment
58+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
node_modules/
2-
website/
2+
dist/
33
docs/.vitepress/cache
44
.DS_Store
55
.eslintcache

docs/.vitepress/config.mts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@ import { defineConfig } from 'vitepress'
22

33
// https://vitepress.dev/reference/site-config
44
export default defineConfig({
5-
title: "Goldfish",
6-
description: "A functional programming language",
5+
title: 'Goldfish Scheme',
6+
description: '让 Scheme 和 Python 一样易用且实用',
7+
8+
// 构建输出目录
9+
outDir: '../dist',
10+
11+
// 基础配置
12+
base: '/',
13+
14+
// 清理 URL
15+
cleanUrls: true,
16+
17+
// 最后更新时间
18+
lastUpdated: true,
719
})

docs/.vitepress/theme/Layout.vue

Lines changed: 125 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,133 @@
11
<script setup lang="ts">
22
import { useData } from 'vitepress'
3+
import NavBar from './components/NavBar.vue'
4+
import Footer from './components/Footer.vue'
35
4-
// https://vitepress.dev/reference/runtime-api#usedata
5-
const { site, frontmatter } = useData()
6+
const { frontmatter, page } = useData()
7+
8+
// 格式化时间戳
9+
const formatDate = (timestamp: number): string => {
10+
if (!timestamp) return ''
11+
const date = new Date(timestamp)
12+
return date.toLocaleDateString('zh-CN', {
13+
year: 'numeric',
14+
month: 'short',
15+
day: 'numeric'
16+
})
17+
}
618
</script>
719

820
<template>
9-
<div v-if="frontmatter.home">
10-
<h1>{{ site.title }}</h1>
11-
<p>{{ site.description }}</p>
12-
<ul>
13-
<li><a href="/markdown-examples.html">Markdown Examples</a></li>
14-
<li><a href="/api-examples.html">API Examples</a></li>
15-
</ul>
16-
</div>
17-
<div v-else>
18-
<a href="/">Home</a>
19-
<Content />
21+
<div class="layout">
22+
<!-- 导航栏 -->
23+
<NavBar />
24+
25+
<!-- 主要内容区 -->
26+
<main class="main-content">
27+
<!-- 首页布局 -->
28+
<div v-if="frontmatter.home" class="home">
29+
<Content />
30+
</div>
31+
32+
<!-- 文档页面布局 -->
33+
<div v-else class="page">
34+
<Content />
35+
<div v-if="page.lastUpdated" class="last-updated">
36+
最后更新于: {{ formatDate(page.lastUpdated) }}
37+
</div>
38+
</div>
39+
</main>
40+
41+
<!-- 页脚 -->
42+
<Footer />
2043
</div>
2144
</template>
45+
46+
<style scoped>
47+
.layout {
48+
min-height: 100vh;
49+
display: flex;
50+
flex-direction: column;
51+
}
52+
53+
.main-content {
54+
flex: 1;
55+
padding: 2rem;
56+
max-width: 1200px;
57+
margin: 0 auto;
58+
width: 100%;
59+
}
60+
61+
/* 首页样式 - 居中布局 */
62+
.home {
63+
text-align: center;
64+
}
65+
66+
.home :deep(h1) {
67+
font-size: 3rem;
68+
font-weight: 700;
69+
margin-bottom: 1rem;
70+
background: linear-gradient(120deg, #3b82f6, #10b981);
71+
-webkit-background-clip: text;
72+
-webkit-text-fill-color: transparent;
73+
}
74+
75+
.home :deep(p) {
76+
font-size: 1.25rem;
77+
color: #666;
78+
margin-bottom: 2rem;
79+
}
80+
81+
/* 文档页面样式 - 左对齐 */
82+
.page {
83+
text-align: left;
84+
}
85+
86+
.page :deep(h1) {
87+
font-size: 2rem;
88+
margin-bottom: 1rem;
89+
border-bottom: 1px solid #e5e7eb;
90+
padding-bottom: 0.5rem;
91+
}
92+
93+
.page :deep(h2) {
94+
font-size: 1.5rem;
95+
margin-top: 2rem;
96+
margin-bottom: 1rem;
97+
}
98+
99+
.page :deep(p) {
100+
line-height: 1.8;
101+
margin-bottom: 1rem;
102+
}
103+
104+
.page :deep(pre) {
105+
background: #1e1e1e;
106+
color: #d4d4d4;
107+
padding: 1rem;
108+
border-radius: 0.5rem;
109+
overflow-x: auto;
110+
}
111+
112+
.page :deep(code) {
113+
font-family: 'JetBrains Mono', monospace;
114+
background: #f3f4f6;
115+
padding: 0.2em 0.4em;
116+
border-radius: 0.25rem;
117+
font-size: 0.875em;
118+
}
119+
120+
.page :deep(pre code) {
121+
background: transparent;
122+
padding: 0;
123+
}
124+
125+
/* 最后更新时间 */
126+
.last-updated {
127+
margin-top: 3rem;
128+
padding-top: 1rem;
129+
border-top: 1px solid #e5e7eb;
130+
color: #6b7280;
131+
font-size: 0.875rem;
132+
}
133+
</style>
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<script setup lang="ts">
2+
</script>
3+
4+
<template>
5+
<footer class="footer">
6+
<div class="container">
7+
<div class="footer-content">
8+
<div class="footer-left">
9+
<p class="message">Released under the Apache-2.0 License.</p>
10+
<p class="copyright">Copyright © 2024-present MoganLab</p>
11+
</div>
12+
13+
<div class="footer-right">
14+
<a href="https://github.com/MoganLab/goldfish" target="_blank" class="github-link">
15+
<svg viewBox="0 0 24 24" class="github-icon">
16+
<path
17+
fill="currentColor"
18+
d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"
19+
/>
20+
</svg>
21+
GitHub
22+
</a>
23+
</div>
24+
</div>
25+
</div>
26+
</footer>
27+
</template>
28+
29+
<style scoped>
30+
.footer {
31+
background: #f9fafb;
32+
border-top: 1px solid #e5e7eb;
33+
padding: 2rem 0;
34+
margin-top: auto;
35+
}
36+
37+
.container {
38+
max-width: 1200px;
39+
margin: 0 auto;
40+
padding: 0 2rem;
41+
}
42+
43+
.footer-content {
44+
display: flex;
45+
justify-content: space-between;
46+
align-items: center;
47+
}
48+
49+
.footer-left {
50+
text-align: left;
51+
}
52+
53+
.message,
54+
.copyright {
55+
margin: 0;
56+
color: #6b7280;
57+
font-size: 0.875rem;
58+
}
59+
60+
.github-link {
61+
display: flex;
62+
align-items: center;
63+
gap: 0.5rem;
64+
text-decoration: none;
65+
color: #4b5563;
66+
font-weight: 500;
67+
transition: color 0.2s;
68+
}
69+
70+
.github-link:hover {
71+
color: #3b82f6;
72+
}
73+
74+
.github-icon {
75+
width: 1.25rem;
76+
height: 1.25rem;
77+
}
78+
79+
@media (max-width: 640px) {
80+
.footer-content {
81+
flex-direction: column;
82+
gap: 1rem;
83+
text-align: center;
84+
}
85+
86+
.footer-left {
87+
text-align: center;
88+
}
89+
}
90+
</style>

0 commit comments

Comments
 (0)