Files
epic-ui/.drone.yml
hu xiaotong c945c99174 ci: 添加 Epic UI 构建和部署工作流
- 新增 CI/CD 工作流文件,实现前端项目的自动构建和部署
- 支持 main、master 和 develop 分支的自动构建- 包含代码检出、环境安装、依赖管理、项目构建等步骤
- 实现构建产物的自动部署和 Docker 容器重启
2025-07-09 11:38:56 +08:00

52 lines
1.5 KiB
YAML

kind: pipeline
type: docker
name: default
trigger:
event:
- manual
- custom
steps:
- name: build
image: node:18-alpine
commands:
- echo "=== 安装依赖 ==="
- npm install -g pnpm
- pnpm install
- echo "=== 构建项目 ==="
- pnpm build
- echo "=== 检查构建结果 ==="
- ls -la dist/
- name: upload
image: appleboy/drone-scp
settings:
host: 193.112.151.199
username: root
password:
from_secret: scp_password
port: 222
source:
- dist/*
target: /opt/1panel/apps/openresty/openresty/www/sites/epic7/index
strip_components: 1
- name: set permissions
image: appleboy/drone-ssh
settings:
host: 193.112.151.199
username: root
password:
from_secret: scp_password
port: 222
script:
- echo "=== 检查部署文件 ==="
- ls -la /opt/1panel/apps/openresty/openresty/www/sites/epic7/index/
- echo "=== 设置文件权限 ==="
- chown -R www-data:www-data /opt/1panel/apps/openresty/openresty/www/sites/epic7/index/
- chmod -R 755 /opt/1panel/apps/openresty/openresty/www/sites/epic7/index/
- echo "=== 重新加载OpenResty配置 ==="
- docker exec $(docker ps -q --filter "name=1Panel-openresty") nginx -s reload || echo "Failed to reload OpenResty config"
- echo "=== 检查OpenResty容器状态 ==="
- docker ps | grep openresty || echo "OpenResty container not found"