From 44567c10e4efb308d3401432ef2a8200badf876f Mon Sep 17 00:00:00 2001 From: root <834207172@qq.com> Date: Sat, 11 Apr 2026 13:13:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20.gitea/workflows/.gitlab-c?= =?UTF-8?q?i.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/.gitlab-ci.yml | 51 ++++++++++++++++----------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/.gitea/workflows/.gitlab-ci.yml b/.gitea/workflows/.gitlab-ci.yml index 72051e3..184062c 100644 --- a/.gitea/workflows/.gitlab-ci.yml +++ b/.gitea/workflows/.gitlab-ci.yml @@ -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 + # 关键:必须先安装 Git(Debian 用 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 }} 发布完成 =========" \ No newline at end of file + run: echo "====== ${{ matrix.module }} 完成 ======" \ No newline at end of file