From c67487ba162773df898f27acde544e8a1a09fc2e Mon Sep 17 00:00:00 2001 From: chendelian <116870791@qq.com> Date: Fri, 10 Apr 2026 13:31:08 +0800 Subject: [PATCH] ci: add reusable-release-frontend for static sites (fangzhen) --- .../workflows/reusable-release-frontend.yaml | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/reusable-release-frontend.yaml b/.github/workflows/reusable-release-frontend.yaml index a9df53d..a99fddf 100644 --- a/.github/workflows/reusable-release-frontend.yaml +++ b/.github/workflows/reusable-release-frontend.yaml @@ -1,5 +1,8 @@ # Standalone reusable workflow for Node/Vite static sites. # Does not reference reusable-release-skill.yaml; skill workflows remain unchanged. +# +# Node:请在 Runner 上预装 Node 20+(勿用 actions/setup-node,避免每次从 GitHub 拉包)。 +# npm:通过 npm_registry 输入使用国内镜像(默认 npmmirror)。 name: Reusable Frontend Deploy @@ -11,10 +14,6 @@ on: required: false type: string default: "/www/wwwroot/fangzhen" - node_version: - required: false - type: string - default: "20" build_command: required: false type: string @@ -44,11 +43,15 @@ jobs: - name: Checkout uses: http://120.25.191.12:3000/admin/actions-checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ inputs.node_version }} - cache: npm + - name: Check Node.js (pre-installed on runner) + run: | + set -e + command -v node >/dev/null || { echo "Runner 上未找到 node,请先安装 Node 20+"; exit 1; } + command -v npm >/dev/null || { echo "Runner 上未找到 npm"; exit 1; } + node -v + npm -v + NODE_MAJOR=$(node -p "process.versions.node.split('.')[0]") + test "$NODE_MAJOR" -ge 20 || { echo "需要 Node 20 及以上,当前: $(node -v)"; exit 1; } - name: Install dependencies run: npm ci