Files
hzdyjs/.drone.yml
T

61 lines
2.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 仅 tag 触发:顺序打包 backend / mobile-h5
# web 暂不在 CI 构建(测试机内存不足以跑 Vite 生产包),后续另议
# 产物:/root/hzdyjs-releases/<tag>/{backend,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-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-workspace.yaml 无 packages 字段,pnpm9 会直接失败;单包工程移走即可
- mv pnpm-workspace.yaml pnpm-workspace.yaml.ci-bak 2>/dev/null || true
# pnpm-lock.yaml 被 gitignore,不能 --frozen-lockfile
# 跳过 puppeteer 下载 Chromium(H5 构建不需要,否则会卡很久)
- export PUPPETEER_SKIP_DOWNLOAD=1 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
- pnpm install --no-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"