GFramework/.github/workflows/publish-docs.yml
GeWuYou a5a90a59bd chore(workflow): 更新 Bun 版本配置
- 将 publish-docs.yml 工作流中的 Bun 版本从 2.1.x 改为 latest
- 保持缓存配置不变
2026-02-11 13:53:35 +08:00

80 lines
2.0 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 工作流名称Publish Docs
# 该工作流用于在推送标签或手动触发时构建并部署文档到 GitHub Pages
name: Publish Docs
# 触发条件配置
# 当推送以 'v' 开头的标签时触发,或者通过 GitHub UI 手动触发
on:
push:
tags:
- 'v*'
workflow_dispatch:
# 权限配置
# 配置工作流所需的权限:
# - contents: read读取仓库内容
# - pages: write写入 GitHub Pages
# - id-token: write写入身份令牌
permissions:
contents: read
pages: write
id-token: write
# 并发控制配置
# 设置并发组为 "pages",并且不允许取消正在进行的任务
concurrency:
group: pages
cancel-in-progress: false
# 定义工作流中的任务
jobs:
# 构建和部署任务
build-and-deploy:
# 条件判断:仅当推送的是正式版本标签(不包含预发布标识)或手动触发时执行
if: |
(startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-'))
|| github.event_name == 'workflow_dispatch'
# 指定运行环境为最新版 Ubuntu
runs-on: ubuntu-latest
# 环境配置
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# 步骤定义
steps:
# 检出代码
- name: Checkout
uses: actions/checkout@v4
# 安装 Bun 运行时
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
cache: true
# 安装项目依赖
- name: Install Dependencies
working-directory: docs
run: bun install
# 构建 VitePress 文档
- name: Build VitePress
working-directory: docs
run: bun run build
# 上传构建产物作为 Pages 部署工件
- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist
# 将文档部署到 GitHub Pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4