ci: add reusable-release-frontend for static sites (fangzhen)
This commit is contained in:
21
.github/workflows/reusable-release-frontend.yaml
vendored
21
.github/workflows/reusable-release-frontend.yaml
vendored
@@ -1,5 +1,8 @@
|
|||||||
# Standalone reusable workflow for Node/Vite static sites.
|
# Standalone reusable workflow for Node/Vite static sites.
|
||||||
# Does not reference reusable-release-skill.yaml; skill workflows remain unchanged.
|
# 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
|
name: Reusable Frontend Deploy
|
||||||
|
|
||||||
@@ -11,10 +14,6 @@ on:
|
|||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
default: "/www/wwwroot/fangzhen"
|
default: "/www/wwwroot/fangzhen"
|
||||||
node_version:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: "20"
|
|
||||||
build_command:
|
build_command:
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
@@ -44,11 +43,15 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: http://120.25.191.12:3000/admin/actions-checkout@v4
|
uses: http://120.25.191.12:3000/admin/actions-checkout@v4
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Check Node.js (pre-installed on runner)
|
||||||
uses: actions/setup-node@v4
|
run: |
|
||||||
with:
|
set -e
|
||||||
node-version: ${{ inputs.node_version }}
|
command -v node >/dev/null || { echo "Runner 上未找到 node,请先安装 Node 20+"; exit 1; }
|
||||||
cache: npm
|
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
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|||||||
Reference in New Issue
Block a user