📝 测试文档部署

This commit is contained in:
远野千束 2024-08-28 11:38:46 +08:00
parent 8ba6ee805a
commit f6e73dd3be
18 changed files with 159 additions and 8 deletions

64
.github/workflows/deploy-docs.yml vendored Normal file
View File

@ -0,0 +1,64 @@
# 构建 VitePress 站点并将其部署到 GitHub Pages 的示例工作流程
#
name: Deploy VitePress site to Pages
on:
# 在针对 `main` 分支的推送上运行。如果你
# 使用 `master` 分支作为默认分支,请将其更改为 `master`
push:
branches: [main]
# 允许你从 Actions 选项卡手动运行此工作流程
workflow_dispatch:
# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# 只允许同时进行一次部署,跳过正在运行和最新队列之间的运行队列
# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成
concurrency:
group: pages
cancel-in-progress: false
jobs:
# 构建工作
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # 如果未启用 lastUpdated则不需要
# - uses: pnpm/action-setup@v3 # 如果使用 pnpm请取消注释
# - uses: oven-sh/setup-bun@v1 # 如果使用 Bun请取消注释
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm # 或 pnpm / yarn
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install dependencies
run: npm ci # 或 pnpm install / yarn install / bun install
- name: Build with VitePress
run: npm run docs:build # 或 pnpm docs:build / yarn docs:build / bun run docs:build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist
# 部署工作
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

20
.github/workflows/pypi-publish.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: Publish
on:
release:
types: [published]
jobs:
pypi-publish:
name: upload release to PyPI
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- uses: pdm-project/setup-pdm@v3
- name: Publish package distributions to PyPI
run: pdm publish

View File

@ -4,6 +4,16 @@ import { defineConfig } from 'vitepress'
export default defineConfig({ export default defineConfig({
title: "MBCP docs", title: "MBCP docs",
description: "MBCP library docs", description: "MBCP library docs",
locales: {
root: {
label: '简体中文',
lang: 'zh-CN'
},
en: {
label: 'English',
lang: 'en-US'
}
},
themeConfig: { themeConfig: {
// https://vitepress.dev/reference/default-theme-config // https://vitepress.dev/reference/default-theme-config
nav: [ nav: [
@ -22,7 +32,8 @@ export default defineConfig({
], ],
socialLinks: [ socialLinks: [
{ icon: 'github', link: 'https://github.com/vuejs/vitepress' } { icon: 'github', link: 'https://github.com/snowykami/mbcp' }
] ]
} },
srcDir: '.'
}) })

View File

@ -0,0 +1,13 @@
import {defineConfig, type DefaultTheme} from 'vitepress'
export const common = defineConfig({
title: "MBCP docs",
description: "MBCP library docs",
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
socialLinks: [
{icon: 'github', link: 'https://github.com/snowykami/mbcp'}
]
},
srcDir: '.'
})

View File

@ -0,0 +1,10 @@
import {defineConfig, type DefaultTheme} from 'vitepress'
export const en = defineConfig({
lang: "en-US",
description: "A library made for Minecraft particle generation",
themeConfig: {
},
})

View File

@ -0,0 +1,15 @@
import {defineConfig} from "vitepress";
import {common} from './common'
import {en} from './en'
import {zh} from './zh'
export default defineConfig({
...common,
locales:{
root: { label: "简体中文", ...zh },
en: { label: "English", ...en }
}
})

View File

@ -0,0 +1,10 @@
import {defineConfig, type DefaultTheme} from 'vitepress'
export const zh = defineConfig({
lang: "zh-Hans",
description: "一个用于Minecraft粒子计算和生成的库",
themeConfig: {
},
})

View File

@ -4,4 +4,3 @@ order: 1
icon: laptop-code icon: laptop-code
category: API category: API
--- ---

View File

@ -9,10 +9,10 @@ hero:
actions: actions:
- theme: brand - theme: brand
text: 快速开始 text: 快速开始
link: /guide link: md-ex
- theme: alt - theme: alt
text: API text: API文档
link: api link: api/
features: features:
- title: 高可用性 - title: 高可用性

View File

@ -301,7 +301,7 @@ def generate_docs(module_folder: str, output_dir: str, with_top: bool = False, l
os.mkdir(output_dir) os.mkdir(output_dir)
replace_data = { replace_data = {
"__init__": "indedx", "__init__": "index",
".py" : ".md", ".py" : ".md",
} }

View File

@ -8,3 +8,4 @@ Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved
@File : __init__.py @File : __init__.py
@Software: PyCharm @Software: PyCharm
""" """
from .mp_math import *

View File

@ -8,3 +8,11 @@ Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved
@File : __init__.py.py @File : __init__.py.py
@Software: PyCharm @Software: PyCharm
""" """
from .angle import AnyAngle
from .const import *
from .equation import CurveEquation
from .line import Line3
from plane import Plane3
from .point import Point3
from .segment import Segment3
from .vector import Vector3