94 lines
2.7 KiB
YAML
94 lines
2.7 KiB
YAML
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 # 对应你的 GitLab runner tag
|
|
container:
|
|
image: node:18-slim
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
max-parallel: 4 # 关键:同时只跑 2 个模块,其余排队
|
|
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: Install Git
|
|
# run: |
|
|
# apk add --no-cache git
|
|
# git --version # 验证
|
|
- 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 registry
|
|
echo "registry=http://${SERVER_HOST}/npm" > .npmrc
|
|
echo "//${SERVER_HOST}/:_authToken=${AuthToken}" >> .npmrc
|
|
|
|
# 发布
|
|
npm publish || echo "发布失败,继续执行"
|
|
|
|
echo "${{ matrix.module }} 构建完成"
|
|
|
|
- name: Complete
|
|
if: always()
|
|
run: echo "====== ${{ matrix.module }} 发布完成 ========="
|