From 0dd659137a40b753f9edad092bd3e5950d4489c5 Mon Sep 17 00:00:00 2001 From: yinsx Date: Mon, 5 Jan 2026 10:14:11 +0800 Subject: [PATCH] 1 --- .drone.yml | 84 ++++++++++++++++++++++++++++++++++++++++++++++++ .env.development | 1 + .env.production | 1 + 3 files changed, 86 insertions(+) create mode 100644 .drone.yml create mode 100644 .env.development create mode 100644 .env.production diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..61f57b1 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,84 @@ +kind: pipeline # 定义一个管道 +type: docker # 当前管道的类型 +name: test # 当前管道的名称 + +steps: + + # 第一步:构建项目 + - name: 构建项目 + image: node:18-alpine + commands: + - rm -rf node_modules + - npm ci + - npm run build + + # 第二步:上传静态资源到腾讯云COS (使用另一个插件) + - name: 静态资源上传到cos + image: ccr.ccs.tencentyun.com/xiaoqidun/gocos:latest + settings: + secret_id: + from_secret: cos_secret_id + secret_key: + from_secret: cos_secret_key + bucket_url: https://files-1302416092.cos.ap-shanghai.myqcloud.com + source_path: dist + target_path: /studio + strip_prefix: dist + + # 第三步:部署到服务器 + - name: 清除服务器缓存 + image: appleboy/drone-ssh + settings: + host: + from_secret: server_host + username: + from_secret: server_username + password: + from_secret: server_password + # 或者使用SSH密钥 + # key: + # from_secret: server_ssh_key + port: 22 + script: + - rm -rf /www/wwwroot/doc.zguiy.com/* + - mkdir -p /www/wwwroot/doc.zguiy.com/ + - chmod 755 /www/wwwroot/doc.zguiy.com/ + when: + branch: + - main + - master + - dev + + # 第四步:上传构建文件 + - name: 上传构建文件 + image: appleboy/drone-scp + settings: + host: + from_secret: server_host + username: + from_secret: server_username + password: + from_secret: server_password + # 或者使用SSH密钥 + # key: + # from_secret: server_ssh_key + port: 22 + source: dist/* + target: /www/wwwroot/doc.zguiy.com/ + strip_components: 1 + when: + branch: + - main + - master + - dev + + +# 触发条件 +trigger: + branch: + - main + - master + - dev + event: + - push + - pull_request diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..b1d28a5 --- /dev/null +++ b/.env.development @@ -0,0 +1 @@ +VITE_PUBLIC = / diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..aeb8fd9 --- /dev/null +++ b/.env.production @@ -0,0 +1 @@ +VITE_PUBLIC = https://cdn.files.zguiy.com/studio/ \ No newline at end of file