mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-14 11:01:06 +08:00
57 lines
1.5 KiB
YAML
57 lines
1.5 KiB
YAML
name: Deploy Documentation
|
||
|
||
on:
|
||
workflow_call:
|
||
inputs:
|
||
build-id:
|
||
required: false
|
||
type: string
|
||
workflow_dispatch:
|
||
|
||
permissions:
|
||
contents: write
|
||
|
||
jobs:
|
||
build-docs:
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- name: Checkout repository
|
||
uses: actions/checkout@v3
|
||
with:
|
||
fetch-depth: 1
|
||
|
||
- name: Log build
|
||
run: echo "Running documentation deployment from build ${{ inputs.build-id }}"
|
||
|
||
- name: Setup Bun
|
||
uses: oven-sh/setup-bun@v1
|
||
with:
|
||
bun-version: latest
|
||
|
||
- name: Install Bun dependencies
|
||
run: bun install
|
||
working-directory: ./docs
|
||
|
||
- name: Generate API MDX
|
||
run: bun run generate
|
||
working-directory: ./docs
|
||
|
||
- name: Build documentation
|
||
# 确保这里最终执行的是 next build(且 next.config 已 output: 'export')
|
||
run: bun run build
|
||
working-directory: ./docs
|
||
|
||
- name: Assert static output exists
|
||
run: |
|
||
test -f ./docs/out/index.html || (echo "❌ ./docs/out/index.html 不存在:请检查 next.config 的 output:'export' / basePath 配置" && exit 1)
|
||
echo "✅ Found ./docs/out/index.html"
|
||
find ./docs/out -maxdepth 2 -type f | head -n 30
|
||
|
||
- name: Deploy to GitHub Pages
|
||
uses: JamesIves/github-pages-deploy-action@v4
|
||
with:
|
||
branch: gh-pages
|
||
folder: ./docs/out
|
||
clean: true
|
||
cname: docs.open-isle.com
|