# 仅 tag 触发:在内网 Runner 顺序打包 backend / mobile-h5 / web # 产物:/root/hzdyjs-releases//{backend,mobile-h5,web}-.* # 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-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 # H5 构建不需要 Chromium - export PUPPETEER_SKIP_DOWNLOAD=1 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 - pnpm install --frozen-lockfile --registry https://registry.npmmirror.com - 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" - name: package-web image: node:20-bookworm environment: NPM_CONFIG_REGISTRY: https://registry.npmmirror.com commands: - set -eu - echo "==> web tag=${DRONE_TAG} commit=${DRONE_COMMIT}" - test -n "${DRONE_TAG}" - mkdir -p "/hzdyjs-releases/${DRONE_TAG}" - cd web # 固定兼容 Node 20 的 npm 11,避开镜像内 npm 10 的 edgesOut 解析异常。 - npm install --global npm@11.21.1 --no-audit --no-fund --registry https://registry.npmmirror.com - npm install --no-audit --no-fund --registry https://registry.npmmirror.com # build:ci 使用 6 GB Node 堆并限制 Vite 并行,避免与其他打包步骤叠加内存。 - npm run build:ci - test -s 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" - sha256sum "/hzdyjs-releases/${DRONE_TAG}/web-${DRONE_TAG}.tar.gz"