From 430721b09c08c306df4b171b098fb840d3c6caa5 Mon Sep 17 00:00:00 2001 From: root <834207172@qq.com> Date: Sat, 11 Apr 2026 13:11:12 +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 | 71 ++++++++++++++------------------- 1 file changed, 31 insertions(+), 40 deletions(-) diff --git a/.gitea/workflows/.gitlab-ci.yml b/.gitea/workflows/.gitlab-ci.yml index 7efe103..72051e3 100644 --- a/.gitea/workflows/.gitlab-ci.yml +++ b/.gitea/workflows/.gitlab-ci.yml @@ -10,15 +10,14 @@ env: AuthToken: ${{ vars.AUTH_TOKEN }} jobs: - # 定义所有模块矩阵 publish: - runs-on: dev # 对应你的 GitLab runner tag + runs-on: dev container: image: node:18-slim strategy: fail-fast: false - max-parallel: 4 # 关键:同时只跑 2 个模块,其余排队 + max-parallel: 4 matrix: module: - 00.StaryEvo @@ -39,31 +38,29 @@ jobs: - 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: 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 @@ -74,20 +71,14 @@ jobs: 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 }} 构建完成" + + 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 }} 发布完成 =========" + run: echo "====== ${{ matrix.module }} 发布完成 =========" \ No newline at end of file