diff --git a/.drone.yml b/.drone.yml index 5c1c578..d110245 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,61 +1,47 @@ -kind: pipeline # 定义对象类型,还有secret和signature两种类型 - -type: docker # 定义流水线类型,还有kubernetes、exec、ssh等类型 - -name: filesystem-drone # 定义流水线名称 - - -steps: # 定义流水线执行步骤,这些步骤将顺序执行 - - name: font-build +kind: pipeline +type: docker +name: microservice-build - image: node:18.18.0 - - volumes: - - - name: build-font - - path: /build/dist-prod +# 定义全局环境变量 +environment: + SERVICE: ${DRONE_SERVICE} +steps: + - name: build-service + image: maven:3-jdk-8 commands: + - echo "Building Service: ${SERVICE}" + - | + if [ "${SERVICE}" = "gateway-service" ]; then + echo "Building Gateway Service..." - - cd yudao-admin-vue3 + elif [ "${SERVICE}" = "system-service" ]; then + echo "Building System Service..." - - npm install --registry=https://registry.npmmirror.com/ + else + echo "Building All Services..." - - npm run build:prod + # 如果有其他服务,可以在这里继续添加 + fi - - ls + - name: test-service + image: maven:3-jdk-8 + commands: + - echo "Testing Service: ${SERVICE}" + - | + if [ "${SERVICE}" = "gateway-service" ]; then + echo "Testing Gateway Service..." - - cp -r dist-prod/. /build/dist-prod + elif [ "${SERVICE}" = "system-service" ]; then + echo "Testing System Service..." - - cd .. + else + echo "Testing All Services..." - - - name: copy package - - image: appleboy/drone-ssh # SSH工具镜像 - - settings: - - host: 101.43.112.107 # 远程连接地址 - - username: root # 远程连接账号 - - password: - - from_secret: ssh_password # 从Secret中读取SSH密码 - - port: 22 # 远程连接端口 - - command_timeout: 5m # 远程执行命令超时时间 - - script: - - scp -r /zymail/font/dist-prod root@1.14.205.126:/root/zyEjmall/zyEj-admin-vue3 + # 如果有其他服务,可以在这里继续添加 + fi - - -volumes: # 定义流水线挂载目录,用于共享数据 - - - name: build-font - host: - path: /zymail/font/dist-prod # 从宿主机中挂载的目录 \ No newline at end of file +parameters: + SERVICE: + description: "The service to build and test. Leave empty to build and test all services." + default: ""