Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

修正部分问题 #2

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 0 additions & 64 deletions .github/workflows/deploy.yml

This file was deleted.

52 changes: 52 additions & 0 deletions .github/workflows/deploy.yml.demo
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Deploy VitePress site to Pages

on:
push:
branches: [main] # 修改为你需要运行的分支,默认为 main(即默认主分支名称)

workflow_dispatch:

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,则保持为 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install dependencies
run: yarn install
- name: Build with VitePress
run: yarn 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
docs/.vitepress/dist/
build/
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# YSP-Server

## 运行
### 本地部署

在控制台依次输入以下指令:

```bash
yarn install
yarn docs:build
```

打开`docs/.vitepress/dist/`即可看到构建好的文件。

### 在 Cloudfalre Page 部署

在`变量`一栏增加以下内容:

```bash
NODE_VERSION = 20.11.1
NPM_VERSION = 10.5.0
YARN_VERSION = 1.22.22
```

构建区域需要做以下调整
- 构建命令设置为 `yarn docs:build`
- 输出目录设置为 `docs/.vitepress/dist/`

点击`部署`即可。

### 在 GitHub Page 部署

> [!WARNING]
> 如果不打算在 GitHub Page 部署,请忽视此部分,否则 Actions 会频繁报错

1. 参照注释修改`.github/workflows`目录中的`deploy.yml.demo` 文件。

2. 将`deploy.yml.demo`重命名为`deploy.yml`。

3. 在存储库设置中的`Pages`菜单项下,选择`Build and deployment` > `Source` > `GitHub Actions`。

4. 将更改推送到`你所设定的分支`并等待 GitHub Action 工作流完成。

你应该看到站点部署到`https://<username>.github.io/[repository]/`或`https://<custom-domain>/`,这取决于你的设置。你的站点将在`你所设定的分支`出现新的提交时自动部署。
Loading