feat: 增加 Drone tag 触发的 backend/web/mobile-h5 三端打包流水线
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
b26bf58744
commit
97706f1c5e
3 files changed
+189
No files matched your search
+70
@@ -0,0 +1,70 @@
|
||||
# 仅 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
|
||||
image: node:20-bookworm
|
||||
environment:
|
||||
NPM_CONFIG_REGISTRY: https://registry.npmmirror.com
|
||||
commands:
|
||||
- set -eu
|
||||
- echo "==> web tag=${DRONE_TAG}"
|
||||
- mkdir -p "/hzdyjs-releases/${DRONE_TAG}"
|
||||
- cd web
|
||||
- npm ci
|
||||
- npm run build:prod
|
||||
- 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"
|
||||
Reference in new issue
Block a user