关闭按需 Element Plus 样式与构建期 dts、限制 rollup 并行、CI 跳过 gzip; 新增 npm run build:ci,供 Drone 在小内存机器上打包。 Co-authored-by: Cursor <cursoragent@cursor.com>
76 lines
2.6 KiB
YAML
76 lines
2.6 KiB
YAML
# 仅 tag 触发:顺序打包 backend / web / mobile-h5
|
||
# 产物:/root/hzdyjs-releases/<tag>/{backend,web,mobile-h5}-<tag>.*
|
||
# Maven 缓存:宿主机 /root/maven-repo → 容器 /maven-repo(由 runner DRONE_RUNNER_VOLUMES 注入)
|
||
# 发版目录:/root/hzdyjs-releases → /hzdyjs-releases(同上,勿在本文件重复挂载)
|
||
|
||
kind: pipeline
|
||
type: docker
|
||
name: package-prod
|
||
|
||
concurrency:
|
||
limit: 1
|
||
|
||
trigger:
|
||
event:
|
||
- tag
|
||
|
||
clone:
|
||
depth: 1
|
||
|
||
steps:
|
||
- name: package-backend
|
||
image: maven:3.9-eclipse-temurin-17
|
||
commands:
|
||
- set -eu
|
||
- echo "==> backend tag=${DRONE_TAG} commit=${DRONE_COMMIT}"
|
||
- test -n "${DRONE_TAG}"
|
||
- mkdir -p "/hzdyjs-releases/${DRONE_TAG}"
|
||
- cd backend
|
||
- |
|
||
mvn clean package -Pprod \
|
||
-Dmaven.test.skip=true \
|
||
-Dmaven.compiler.parameters=true \
|
||
-Dmaven.repo.local=/maven-repo
|
||
- test -f ruoyi-admin/target/ruoyi-admin.jar
|
||
- cp -v ruoyi-admin/target/ruoyi-admin.jar "/hzdyjs-releases/${DRONE_TAG}/backend-${DRONE_TAG}.jar"
|
||
- ls -lh "/hzdyjs-releases/${DRONE_TAG}/backend-${DRONE_TAG}.jar"
|
||
|
||
- name: package-web
|
||
# 无 package-lock(被 gitignore);Node20 需 --legacy-peer-deps 规避 npm edgesOut
|
||
# 低内存模式:串行 transform、关 gzip 插件、3G 堆(见 web build:ci)
|
||
image: node:20-bookworm
|
||
environment:
|
||
NPM_CONFIG_REGISTRY: https://registry.npmmirror.com
|
||
CI: 'true'
|
||
VITE_LOW_MEM: '1'
|
||
VITE_BUILD_COMPRESS: ''
|
||
commands:
|
||
- set -eu
|
||
- echo "==> web tag=${DRONE_TAG} npm=$(npm -v) node=$(node -v) low_mem=${VITE_LOW_MEM}"
|
||
- mkdir -p "/hzdyjs-releases/${DRONE_TAG}"
|
||
- cd web
|
||
- npm install --legacy-peer-deps --no-audit --no-fund
|
||
- npm run build:ci
|
||
- test -f dist/index.html
|
||
- tar -C dist -czf "/hzdyjs-releases/${DRONE_TAG}/web-${DRONE_TAG}.tar.gz" .
|
||
- ls -lh "/hzdyjs-releases/${DRONE_TAG}/web-${DRONE_TAG}.tar.gz"
|
||
|
||
- name: package-mobile-h5
|
||
image: node:20-bookworm
|
||
environment:
|
||
NPM_CONFIG_REGISTRY: https://registry.npmmirror.com
|
||
commands:
|
||
- set -eu
|
||
- echo "==> mobile-h5 tag=${DRONE_TAG}"
|
||
- mkdir -p "/hzdyjs-releases/${DRONE_TAG}"
|
||
- corepack enable
|
||
- corepack prepare pnpm@9 --activate
|
||
- cd mobile
|
||
- pnpm config set registry https://registry.npmmirror.com
|
||
- pnpm install --frozen-lockfile
|
||
- pnpm run build
|
||
- test -d dist/build/h5
|
||
- tar -C dist/build/h5 -czf "/hzdyjs-releases/${DRONE_TAG}/mobile-h5-${DRONE_TAG}.tar.gz" .
|
||
- ls -lh "/hzdyjs-releases/${DRONE_TAG}/"
|
||
- ls -lh "/hzdyjs-releases/${DRONE_TAG}/mobile-h5-${DRONE_TAG}.tar.gz"
|