Files
OpenIsle/.github/workflows/deploy-docs.yml
2025-09-09 13:03:08 +08:00

63 lines
1.8 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.
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'] || 'manual' }}"
- 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 export)
run: bun run build
working-directory: ./docs
# 确保你的 package.json 的 build 最终会生成 ./docs/out
# 对于 Next需要包含 next export若没有可在这里追加一行
# run: bun run build && bunx next export
- name: Add .nojekyll & CNAME into publish dir
run: |
test -d ./docs/out || (echo "❌ ./docs/out not found. Did build/export run?" && exit 1)
touch ./docs/out/.nojekyll
echo "docs.open-isle.com" > ./docs/out/CNAME
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: ./docs/out
clean: true
single-commit: true
git-config-name: github-actions[bot]
git-config-email: github-actions[bot]@users.noreply.github.com
# 也可以不写上面的 CNAME 步骤,改用这一行由 Action 生成:
# cname: docs.open-isle.com