docs: 优化文档 #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "📘 Deploy docs" | |
on: | |
workflow_dispatch: | |
inputs: | |
runtime: | |
type: choice | |
description: JS runtime | |
default: "pnpm" | |
options: | |
- "bun" | |
- "pnpm" | |
workflow_call: | |
inputs: | |
sensorouiversion: | |
type: string | |
push: | |
branches: | |
- main | |
paths: | |
- "docs/**" | |
- "CHANGELOG.md" | |
jobs: | |
deploy-docs: | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
env: | |
runtime: ${{ inputs.runtime || 'pnpm'}} | |
LEMONSQUEEZY_API_KEY: ${{ secrets.LEMONSQUEEZY_API_KEY }} | |
YOUTUBE_API_KEY: ${{ secrets.YOUTUBE_API_KEY }} | |
sensorouiversion: ${{ inputs.sensorouiversion || 'latest' }} | |
if: | | |
github.event_name == 'workflow_dispatch' || | |
github.event_name == 'workflow_call' || | |
github.event_name == 'push' || | |
github.event.workflow_run.conclusion == 'success' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 10 | |
clean: false | |
- name: Setup Node | |
if: env.runtime == 'pnpm' | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "21.1.0" | |
registry-url: https://registry.npmjs.org | |
- name: Setup bun | |
if: env.runtime == 'bun' | |
uses: oven-sh/setup-bun@v1 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: latest | |
- name: Install package dependencies | |
run: ${{ env.runtime }} install | |
- name: Build package | |
run: ${{ env.runtime }} run build:skipfullcss | |
- name: Build docs | |
run: | | |
cd docs | |
if [ -z "${{inputs.sensorouiversion}}" ]; then | |
${{ env.runtime }} run build | |
else | |
VITE_DAISYUI_VERSION=${{inputs.sensorouiversion}} ${{ env.runtime }} run build | |
fi | |
- name: Deploy docs to github pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/build | |
cname: sensoroui.xingkang.wang |