Skip to content

Commit

Permalink
📝 测试文档部署
Browse files Browse the repository at this point in the history
  • Loading branch information
snowykami committed Aug 28, 2024
1 parent 8ba6ee8 commit f6e73dd
Show file tree
Hide file tree
Showing 18 changed files with 159 additions and 8 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 20 additions & 0 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -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
15 changes: 13 additions & 2 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ import { defineConfig } from 'vitepress'
export default defineConfig({
title: "MBCP docs",
description: "MBCP library docs",
locales: {
root: {
label: '简体中文',
lang: 'zh-CN'
},
en: {
label: 'English',
lang: 'en-US'
}
},
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [
Expand All @@ -22,7 +32,8 @@ export default defineConfig({
],

socialLinks: [
{ icon: 'github', link: 'https://github.com/vuejs/vitepress' }
{ icon: 'github', link: 'https://github.com/snowykami/mbcp' }
]
}
},
srcDir: '.'
})
13 changes: 13 additions & 0 deletions docs/.vitepress/config/common.ts
Original file line number Diff line number Diff line change
@@ -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: '.'
})
10 changes: 10 additions & 0 deletions docs/.vitepress/config/en.ts
Original file line number Diff line number Diff line change
@@ -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: {
},
})
15 changes: 15 additions & 0 deletions docs/.vitepress/config/index.ts
Original file line number Diff line number Diff line change
@@ -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 }
}
})
10 changes: 10 additions & 0 deletions docs/.vitepress/config/zh.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {defineConfig, type DefaultTheme} from 'vitepress'

export const zh = defineConfig({

lang: "zh-Hans",
description: "一个用于Minecraft粒子计算和生成的库",

themeConfig: {
},
})
File renamed without changes.
3 changes: 1 addition & 2 deletions docs/api/indedx.md → docs/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ title: mbcp.\n\ninit\n\n
order: 1
icon: laptop-code
category: API
---

---
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ hero:
actions:
- theme: brand
text: 快速开始
link: /guide
link: md-ex
- theme: alt
text: API
link: api
text: API文档
link: api/

features:
- title: 高可用性
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/mkdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def generate_docs(module_folder: str, output_dir: str, with_top: bool = False, l
os.mkdir(output_dir)

replace_data = {
"__init__": "indedx",
"__init__": "index",
".py" : ".md",
}

Expand Down
1 change: 1 addition & 0 deletions mbcp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
@File : __init__.py
@Software: PyCharm
"""
from .mp_math import *
8 changes: 8 additions & 0 deletions mbcp/mp_math/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@
@File : __init__.py.py
@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

0 comments on commit f6e73dd

Please sign in to comment.