feat: docs workflow

This commit is contained in:
Lan
2025-02-12 14:51:08 +08:00
parent 2743c7a89b
commit 93fa6ad4e7
2 changed files with 232 additions and 211 deletions
+10 -7
View File
@@ -6,7 +6,7 @@ on:
# 在针对 `main` 分支的推送上运行。如果你 # 在针对 `main` 分支的推送上运行。如果你
# 使用 `master` 分支作为默认分支,请将其更改为 `master` # 使用 `master` 分支作为默认分支,请将其更改为 `master`
push: push:
branches: [master] branches: [ master ]
# 允许你从 Actions 选项卡手动运行此工作流程 # 允许你从 Actions 选项卡手动运行此工作流程
workflow_dispatch: workflow_dispatch:
@@ -32,21 +32,24 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 # 如果未启用 lastUpdated,则不需要 fetch-depth: 0 # 如果未启用 lastUpdated,则不需要
# - uses: pnpm/action-setup@v3 # 如果使用 pnpm,请取消此区域注释 - uses: pnpm/action-setup@v3
# with: with:
# version: 9 version: 9
# - uses: oven-sh/setup-bun@v1 # 如果使用 Bun,请取消注释 # - uses: oven-sh/setup-bun@v1 # 如果使用 Bun,请取消注释
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
cache: pnpm # 或 pnpm / yarn cache: 'pnpm'
cache-dependency-path: 'docs/pnpm-lock.yaml'
- name: Setup Pages - name: Setup Pages
uses: actions/configure-pages@v4 uses: actions/configure-pages@v4
- name: Install dependencies - name: Install dependencies
run: pnpm install # 或 pnpm install / yarn install / bun install working-directory: docs
run: pnpm install
- name: Build with VitePress - name: Build with VitePress
run: pnpm run docs:build # 或 pnpm docs:build / yarn docs:build / bun run docs:build working-directory: docs
run: pnpm run docs:build
- name: Upload artifact - name: Upload artifact
uses: actions/upload-pages-artifact@v3 uses: actions/upload-pages-artifact@v3
with: with:
+54 -36
View File
@@ -1,9 +1,10 @@
import {defineConfig} from 'vitepress' import { defineConfig } from 'vitepress'
// https://vitepress.dev/reference/site-config // https://vitepress.dev/reference/site-config
export default defineConfig({ export default defineConfig({
title: 'FileCodeBox', title: 'FileCodeBox',
description: '简单高效的文件分享工具', description: '简单高效的文件分享工具',
base: '/FileCodeBox/',
lang: 'zh-CN', lang: 'zh-CN',
lastUpdated: true, lastUpdated: true,
locales: { locales: {
@@ -15,14 +16,14 @@ export default defineConfig({
themeConfig: { themeConfig: {
logo: '/logo_small.png', logo: '/logo_small.png',
nav: [ nav: [
{text: '首页', link: '/'}, { text: '首页', link: '/' },
{text: '指南', link: '/guide/getting-started'}, { text: '指南', link: '/guide/getting-started' },
{text: 'API', link: '/api/'}, { text: 'API', link: '/api/' },
{ {
text: '了解更多', text: '了解更多',
items: [ items: [
{text: '更新日志', link: '/changelog'}, { text: '更新日志', link: '/changelog' },
{text: '贡献指南', link: '/contributing'}, { text: '贡献指南', link: '/contributing' },
], ],
}, },
], ],
@@ -36,23 +37,23 @@ export default defineConfig({
text: '什么是 FileCodeBox', text: '什么是 FileCodeBox',
link: '/guide/introduction', link: '/guide/introduction',
}, },
{text: '快速开始', link: '/guide/getting-started'}, { text: '快速开始', link: '/guide/getting-started' },
], ],
}, },
{ {
text: '基础功能', text: '基础功能',
items: [ items: [
{text: '文件上传', link: '/guide/upload'}, { text: '文件上传', link: '/guide/upload' },
{text: '文件分享', link: '/guide/share'}, { text: '文件分享', link: '/guide/share' },
{text: '文件管理', link: '/guide/management'}, { text: '文件管理', link: '/guide/management' },
], ],
}, },
{ {
text: '高级特性', text: '高级特性',
items: [ items: [
{text: '存储配置', link: '/guide/storage'}, { text: '存储配置', link: '/guide/storage' },
{text: '安全设置', link: '/guide/security'}, { text: '安全设置', link: '/guide/security' },
{text: '系统配置', link: '/guide/configuration'}, { text: '系统配置', link: '/guide/configuration' },
], ],
}, },
], ],
@@ -60,19 +61,19 @@ export default defineConfig({
{ {
text: 'API 参考', text: 'API 参考',
items: [ items: [
{text: '分享接口', link: '/api/#分享接口'}, { text: '分享接口', link: '/api/#分享接口' },
{text: '管理接口', link: '/api/#管理接口'}, { text: '管理接口', link: '/api/#管理接口' },
{text: '错误响应', link: '/api/#错误响应'}, { text: '错误响应', link: '/api/#错误响应' },
{text: '状态码说明', link: '/api/#状态码说明'}, { text: '状态码说明', link: '/api/#状态码说明' },
], ],
}, },
], ],
}, },
socialLinks: [ socialLinks: [
{icon: 'github', link: 'https://github.com/vastsa/FileCodeBox'}, { icon: 'github', link: 'https://github.com/vastsa/FileCodeBox' },
], ],
footer: { footer: {
message: '基于 LGPL 许可发布', message: '基于 MIT 许可发布',
copyright: 'Copyright © 2023-present FileCodeBox', copyright: 'Copyright © 2023-present FileCodeBox',
}, },
search: { search: {
@@ -92,17 +93,18 @@ export default defineConfig({
themeConfig: { themeConfig: {
logo: '/logo_small.png', logo: '/logo_small.png',
nav: [ nav: [
{text: 'Home', link: '/en/'}, { text: 'Home', link: '/en/' },
{text: 'Guide', link: '/en/guide/getting-started'}, { text: 'Guide', link: '/en/guide/getting-started' },
{text: 'API', link: '/en/api/'}, { text: 'API', link: '/en/api/' },
{ {
text: 'More', text: 'More',
items: [ items: [
{text: 'Changelog', link: '/en/changelog'}, { text: 'Changelog', link: '/en/changelog' },
{text: 'Contributing', link: '/en/contributing'}, { text: 'Contributing', link: '/en/contributing' },
], ],
}, },
], ],
sidebar: { sidebar: {
'/en/guide/': [ '/en/guide/': [
{ {
@@ -121,16 +123,16 @@ export default defineConfig({
{ {
text: 'Basic Features', text: 'Basic Features',
items: [ items: [
{text: 'File Upload', link: '/en/guide/upload'}, { text: 'File Upload', link: '/en/guide/upload' },
{text: 'File Sharing', link: '/en/guide/share'}, { text: 'File Sharing', link: '/en/guide/share' },
{text: 'File Management', link: '/en/guide/management'}, { text: 'File Management', link: '/en/guide/management' },
], ],
}, },
{ {
text: 'Advanced Features', text: 'Advanced Features',
items: [ items: [
{text: 'Storage Configuration', link: '/en/guide/storage'}, { text: 'Storage Configuration', link: '/en/guide/storage' },
{text: 'Security Settings', link: '/en/guide/security'}, { text: 'Security Settings', link: '/en/guide/security' },
{ {
text: 'System Configuration', text: 'System Configuration',
link: '/en/guide/configuration', link: '/en/guide/configuration',
@@ -142,19 +144,19 @@ export default defineConfig({
{ {
text: 'API Reference', text: 'API Reference',
items: [ items: [
{text: 'Share API', link: '/en/api/#share-api'}, { text: 'Share API', link: '/en/api/#share-api' },
{text: 'Admin API', link: '/en/api/#admin-api'}, { text: 'Admin API', link: '/en/api/#admin-api' },
{text: 'Error Response', link: '/en/api/#error-response'}, { text: 'Error Response', link: '/en/api/#error-response' },
{text: 'Status Codes', link: '/en/api/#status-codes'}, { text: 'Status Codes', link: '/en/api/#status-codes' },
], ],
}, },
], ],
}, },
socialLinks: [ socialLinks: [
{icon: 'github', link: 'https://github.com/vastsa/FileCodeBox'}, { icon: 'github', link: 'https://github.com/vastsa/FileCodeBox' },
], ],
footer: { footer: {
message: '基于 MIT 许可发布', message: 'Released under the MIT License',
copyright: 'Copyright © 2023-present FileCodeBox', copyright: 'Copyright © 2023-present FileCodeBox',
}, },
search: { search: {
@@ -174,7 +176,7 @@ export default defineConfig({
// 社交链接 // 社交链接
socialLinks: [ socialLinks: [
{icon: 'github', link: 'https://github.com/vastsa/FileCodeBox'}, { icon: 'github', link: 'https://github.com/vastsa/FileCodeBox' },
], ],
// 页脚 // 页脚
@@ -204,6 +206,22 @@ export default defineConfig({
}, },
}, },
}, },
en: {
translations: {
button: {
buttonText: 'Search',
buttonAriaLabel: 'Search docs',
},
modal: {
noResultsText: 'No results found',
resetButtonTitle: 'Clear query',
footer: {
selectText: 'to select',
navigateText: 'to navigate',
},
},
},
},
}, },
}, },
}, },