name: Plugin Library CI on: push: branches: [master, main] workflow_dispatch: # 支持手动触发 env: SERVER_HOST: ${{ vars.SERVER_HOST }} AuthToken: ${{ vars.AUTH_TOKEN }} jobs: publish: runs-on: dev container: image: node:18-slim strategy: fail-fast: false max-parallel: 4 matrix: module: - 00.StaryEvo - 00.StaryEvoTools - 00.BuildOriginality - 00.ARMazTools - 01.HybridCLR - 02.InformationSave - 03.YooAsset - 04.AudioCore - 05.TableTextConversion - 06.UIFarme - 07.RKTools - 08.UniTask - 09.CodeChecker - 10.StoryEditor - 10.XNode - 11.PointCloudTools steps: # 修正:正确的缩进和结构 - name: Clone from Local Mirror run: | # 检查宿主机是否有镜像(需在 runner 上预置) if [ -d "/srv/cache/plugin-library.git" ]; then echo "使用本地裸库镜像..." git clone --reference /srv/cache/plugin-library.git \ --depth=1 --filter=blob:none \ --sparse \ http://106.52.62.106:3000/root/plugin-library.git . else echo "首次克隆,创建本地镜像..." git clone --bare \ http://106.52.62.106:3000/root/plugin-library.git \ /srv/cache/plugin-library.git || true git clone --reference /srv/cache/plugin-library.git \ --depth=1 --filter=blob:none \ --sparse . . fi # 配置稀疏检出 git sparse-checkout set Assets/${{ matrix.module }} - name: Setup Node.js run: | ln -sf /srv/18-alpine/bin/node /usr/bin/node ln -sf /srv/18-alpine/bin/npm /usr/bin/npm node -v - name: Publish ${{ matrix.module }} working-directory: Assets/${{ matrix.module }} run: | echo "开始发布 ${{ matrix.module }}" CURRENT_VERSION=$(node -p "require('./package.json').version") echo "当前版本: $CURRENT_VERSION" npm config set registry "http://${SERVER_HOST}/npm" npm config set "//${SERVER_HOST}/:_authToken" "${AuthToken}" npm publish || echo "发布失败或版本已存在" - name: Complete if: always() run: echo "====== ${{ matrix.module }} 发布完成 ========="