更新 .gitea/workflows/.gitlab-ci.yml
Some checks failed
Plugin Library CI / publish (00.BuildOriginality) (push) Has been cancelled
Plugin Library CI / publish (00.StaryEvo) (push) Has been cancelled
Plugin Library CI / publish (00.StaryEvoTools) (push) Has been cancelled
Plugin Library CI / publish (01.HybridCLR) (push) Has been cancelled
Plugin Library CI / publish (10.StoryEditor) (push) Has been cancelled
Plugin Library CI / publish (10.XNode) (push) Has been cancelled
Plugin Library CI / publish (11.PointCloudTools) (push) Has been cancelled
Plugin Library CI / publish (02.InformationSave) (push) Has been cancelled
Plugin Library CI / publish (03.YooAsset) (push) Has been cancelled
Plugin Library CI / publish (04.AudioCore) (push) Has been cancelled
Plugin Library CI / publish (05.TableTextConversion) (push) Has been cancelled
Plugin Library CI / publish (06.UIFarme) (push) Has been cancelled
Plugin Library CI / publish (07.RKTools) (push) Has been cancelled
Plugin Library CI / publish (08.UniTask) (push) Has been cancelled
Plugin Library CI / publish (09.CodeChecker) (push) Has been cancelled
Plugin Library CI / publish (00.ARMazTools) (push) Has been cancelled

This commit is contained in:
2026-04-11 13:13:52 +08:00
parent 430721b09c
commit 44567c10e4

View File

@@ -3,7 +3,7 @@ name: Plugin Library CI
on:
push:
branches: [master, main]
workflow_dispatch: # 支持手动触发
workflow_dispatch:
env:
SERVER_HOST: ${{ vars.SERVER_HOST }}
@@ -38,41 +38,40 @@ jobs:
- 11.PointCloudTools
steps:
# 修正:正确的缩进和结构
- name: Clone from Local Mirror
# 关键:必须先安装 GitDebian 用 apt-get不是 apk
- name: Install Git
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
apt-get update && apt-get install -y git
git --version
- name: Clone with Sparse Checkout
run: |
git init
git remote add origin http://106.52.62.106:3000/root/plugin-library.git
git config core.sparseCheckout true
# 配置稀疏检出
git sparse-checkout set Assets/${{ matrix.module }}
# 只检出目标模块
mkdir -p .git/info
echo "Assets/${{ matrix.module }}/*" > .git/info/sparse-checkout
# 部分克隆:只拉取当前提交的元数据,不拉历史文件
git fetch --depth=1 --filter=blob:none origin ${{ github.sha }}
git checkout ${{ github.sha }}
echo "已检出:"
ls -la 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
ln -sf /srv/18-alpine/bin/node /usr/bin/node 2>/dev/null || true
ln -sf /srv/18-alpine/bin/npm /usr/bin/npm 2>/dev/null || true
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"
echo "发布 ${{ matrix.module }}@$CURRENT_VERSION"
npm config set registry "http://${SERVER_HOST}/npm"
npm config set "//${SERVER_HOST}/:_authToken" "${AuthToken}"
@@ -81,4 +80,4 @@ jobs:
- name: Complete
if: always()
run: echo "====== ${{ matrix.module }} 发布完成 ========="
run: echo "====== ${{ matrix.module }} 完成 ======"